i want to filter cities using states with 2 select inputes when the first select change it value the second one should be changed according to the first select.
i have an array of items :
$scope.items = [
{
name:'state1',
cities : [
{id:1,name:'city1'},
{id:2,name:'city2'},
]
},
{
name:'state2',
cities : [
{id:1,name:'city1'},
{id:2,name:'city2'},
]
},
];
i tried this but its not working : first for states :
<select ng-model="state" ng-options="s.id as s.name in states" ></select>
second for cities :
<select ng-model="city" ng-options="s.cities.id as s.cities.name for s in items | filter:{s.name:state}" ></select>