我在ng-options filter by value in another dropdown中读到了一些例子。
但在我的情况下,数据在一个范围内。
我试过
Make:
<select ng-model="makeng" ng-options="option.id as option.display for option in makes">
<option ng-disabled="true" ng-selected="true" value="">Select a make</option>
</select>
Model:
<select ng-model="modelng" ng-options="option.data.name for option in makes | filter:{id:makeng}">
<option ng-disabled="true" ng-selected="true" value="">Select a model</option>
</select>
答案 0 :(得分:1)
根本不需要过滤器:
http://plnkr.co/edit/OjM1yJPYV1vQh5HRDNQ1?p=preview
请:
<select ng-model="makeng" ng-options="option as option.display for option in makes">
<option ng-disabled="true" ng-selected="true" value="">Select a make</option>
</select>
型号:
<select ng-model="modelng" ng-options="option.name for option in makes[makes.indexOf(makeng)].data">
<option ng-disabled="true" ng-selected="true" value="">Select a model</option>
</select>