禁用重复内部的按钮

时间:2014-12-04 07:48:53

标签: javascript angularjs ng-repeat

如何禁用ng-repeat中的所有按钮? 这是我的代码..

<div ng-repeat="item in array"> {{item.name}}<button type="button" ng-click="save()" ng-disabled="isDisabled">Submit</button></div>

2 个答案:

答案 0 :(得分:3)

只需在你想要禁用按钮的功能中写ng-disabled = "true"

答案 1 :(得分:2)

如果isDisabled是数组中项目的属性,则使用:

<div ng-repeat="item in array"> {{item.name}}<button type="button" ng-click="save()" ng-disabled="item.isDisabled">Submit</button></div>