AngularJS降下来值动态变化 [英] AngularJS Drop down values change Dynamically
本文介绍了AngularJS降下来值动态变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经用在其中AngularJS和附加数据通过控制器的两种下拉菜单。我想改变的第二个下拉值时,一个变化首次下降出现了。
I have created two drop downs using AngularJS and appended data in them through the controllers. I want to change the second drop down values when a change occurs in first drop down.
我创建例如的,但是当我改变第一个下拉的价值;所述第二下拉值不发生变化。
I create the example, but when I change value of the first drop down; the second drop down values do not change.
推荐答案
更新HTML:
<div ng-controller="exerciseTypeCtrl">
<ul data-role="listview" data-inset="true" >
<li>
<select id="exerciseSuperCategory" data-role="listview" ng-options="catagory as catagory.text for catagory in catagories.cast " ng-model="itemsuper" ng-change="changeData()">
</select>
</li>
</ul>
<ul data-role="listview" data-inset="true">
<li>
<select data-role="listview" ng-options="type as type.text for type in types.cast " ng-model="item1" ng-change="update()">
</select>
</li>
</ul>
更新控制器:
myApp.controller('exerciseTypeCtrl',function($scope,indoors,outdoors,setNulls, catagories){
$scope.catagories = catagories;
$scope.types = setNulls;
$scope.changeData = function() {
//console.log($scope.itemsuper);
if($scope.itemsuper.text == "Indoor") {
$scope.types = indoors;
} else if($scope.itemsuper.text == "Outdoor") {
$scope.types = outdoors;
} else {
$scope.types = setNulls;
}
}
});
这篇关于AngularJS降下来值动态变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文