I have a list of regions, and each region has a drop-down list that should show only the cities in that particular region. I used a nested ng-repeat for this:
<li ng-click="filter_region($event)" ng-repeat="region in regions">
<span>{{region.region}}</span>
<ul class="cityFilter" >
<li ng-repeat="city in cities | filter:cityList">
<input type="checkbox" value="{{city.id}}" ng-model="city.checked" ng-checked="city.checked">
<span>{{city.city}}</span>
</li>
</ul>
</li>
I need cityList as a dynamic filter. Each city should be filtered based on the current region. i.e. the region value needs to change with each iteration of the outer loop
pseudo-code for the filter:
$scope.cityList = function (item) {
if (item.region_id == myDynamicRegion)
return true;
return false;
}
Is it doable?