4

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.

1 Answer 1

10

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your response it is the correct way that i need Thanks for your concerns

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.