时间:2021-05-28
本文实例讲述了AngularJS实现的select二级联动下拉菜单功能。分享给大家供大家参考,具体如下:
<!DOCTYPE html><html ng-app><head lang="en"> <meta charset="UTF-8"> <title></title></head><script src="../script/angular.js"></script><body ng-controller="Controller"><div>所属分类: <select ng-model="selected1" ng-options="m.roleName for m in classification1" ng-change="changeClassification(selected1)"> <option value="">-- 请选择 --</option> </select> <select ng-model="selected2" ng-options="m.roleName for m in classification2"> <option value="">-- 请选择 --</option> </select></div></body><script> var contantCroleList = [ { "roleName" : "软件开发", "roleId" : "role1", "children" : [ { "roleName" : "软件AAA", "roleId" : "role11", "children" : [] }, { "roleName" : "软件BBB", "roleId" : "role12", "children" : []}, { "roleName" : "软件CCC", "roleId" : "role12", "children" : []}, { "roleName" : "软件DDD", "roleId" : "role12", "children" : []}, { "roleName" : "软件EEE", "roleId" : "role12", "children" : []}, { "roleName" : "软件FFF", "roleId" : "role12", "children" : []} ]}, { "roleName" : "硬件开发", "roleId" : "role2", "children" : [ { "roleName" : "硬件AAA", "roleId" : "role21", "children" : [] }, { "roleName" : "硬件BBB", "roleId" : "role22", "children" : []}, { "roleName" : "硬件CCC", "roleId" : "role23", "children" : []}, { "roleName" : "硬件DDD", "roleId" : "role24", "children" : []}, { "roleName" : "硬件EEE", "roleId" : "role25", "children" : []}, { "roleName" : "硬件FFF", "roleId" : "role26", "children" : []} ]}, { "roleName" : "嵌入式开发", "roleId" : "role3", "children" : [ { "roleName" : "嵌入式AAA", "roleId" : "role31", "children" : [] }, { "roleName" : "嵌入式BBB", "roleId" : "role32", "children" : []}, { "roleName" : "嵌入式CCC", "roleId" : "role33", "children" : []}, { "roleName" : "嵌入式DDD", "roleId" : "role34", "children" : []}, { "roleName" : "嵌入式EEE", "roleId" : "role35", "children" : []}, { "roleName" : "嵌入式FFF", "roleId" : "role36", "children" : []} ]} ]; function Controller($scope) { $scope.classification1 = contantCroleList; $scope.changeClassification = function (selected1) { $scope.classification2 = selected1.children; }; }</script></html>更多关于AngularJS相关内容感兴趣的读者可查看本站专题:《AngularJS指令操作技巧总结》、《AngularJS入门与进阶教程》及《AngularJS MVC架构总结》
希望本文所述对大家AngularJS程序设计有所帮助。
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
二级联动下拉菜单选择应用在在很多地方,比如说省市下拉联动,商品大小类下拉选择联动。本文将通过实例讲解使用jQuery+PHP+MySQL来实现大小分类二级下拉联
本文实例为大家分享了js实现二级联动下拉菜单的具体代码,供大家参考,具体内容如下js代码部分:/**全国二级城市联动js版*/functionDsy(){thi
bootstrap-select是boot的下拉搜索插件,使用的时候有时我们需要动态从后台或者直接加载动态数据。下面是根据一级下拉菜单,动态加载二级联动方式。(
本文实例讲述了php+mysql实现的二级联动菜单效果。分享给大家供大家参考,具体如下:生成学院专业级联下拉菜单测试varmajorCount;//存储专业记录
本文实例为大家分享了js实现select二级联动下拉菜单,供大家参考,具体内容如下NewDocument//定义了城市的二维数组,里面的顺序跟省份的顺序是相同的