在另一个下拉NG选项过滤器通过值 [英] ng-options filter by value in another dropdown
本文介绍了在另一个下拉NG选项过滤器通过值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这似乎是一个很简单的code,但我想不通为什么它不工作。
This seems to be a really straight forward code, but I cannot figure out why it is not working.
我想通过选择创造过滤模式下拉列表中,
I want to filter the 'model' dropdown by selected 'make',
Make:
<select ng-model="makeng" ng-options="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.display for option in models | filter:{make:makeng}">
<option ng-disabled="true" ng-selected="true" value="">Select a model</option>
</select>
这里是plunker
here is the plunker
http://plnkr.co/edit/bHb9AScd2m58acUUyI0t?p=$p$ PVIEW
推荐答案
问题是你的第一个ngoption,您需要使用的模型设置为值
属性的值选择以
语法 option.value作为选项。
。
Problem is with your first ngoption, you need to set the model as the value of value
property using select as
syntax option.value as option.
.
<select ng-model="makeng"
ng-options="option.value as option.display for option in makes">
Plnkr
这篇关于在另一个下拉NG选项过滤器通过值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文