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.
Updated 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>
Updated Controller:
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;
}
}
});
Updated Example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With