【发布时间】:2015-12-10 19:25:34
【问题描述】:
我有ng-repeat 选项:
<option ng-repeat="year in data.dateList.year" value="{{year.id}}" ng-disabled="(year.id < 2015) ? true : false">
你可以看到ng-disabled="(year.id < 2015) ? true : false"
如果year.id 小于 2015,为什么我的选项没有被禁用?
这是我的新代码:
<div class="itm" ng-repeat="a in range(num) track by $index">
<option ng-repeat="year in data.dateList.year" ng-disabled="(year.id) < formData.beginYear[$index]">
{{year.value}}
</option>
</div>
【问题讨论】:
-
您应该将
disable子句放在您的ng-repeat中,例如the example at the bottom of the docs。 -
应用过滤器并且不只显示选项
标签: angularjs select ng-repeat ng-options angularjs-ng-options