【发布时间】:2015-05-09 12:41:08
【问题描述】:
我希望输入中的值过滤下拉列表中的值,并且对于 $index == 0 的选项,ng-selected 为真。
当过滤器采取行动时,ng-selected 中的值会更改为 true,并且元素上的 selected 属性不会更改为 selected="selected"。如果我删除模型,它会按预期工作。
<div ng-app ng-controller="AppCtrl" ng-init="sigStyles.companies = ['facebook', 'twitter', 'tumblr', 'myspace']">
<input type="text" ng-model="socialSearch"></input>
<select>
<option ng-repeat="company in sigStyles.companies | filter:socialSearch" value="{{company}}" ng-selected="{{$index === 0}}">{{company}}</option>
</select>
</div>
是否有人知道如何更改选定的属性,或者是否有人知道如何进行搜索输入以根据其输入从选择中删除选项?
链接到我的小提琴here。
【问题讨论】:
标签: angularjs