【发布时间】:2018-02-01 21:15:00
【问题描述】:
任何人都可以帮助弄清楚 ng-checked
$scope.ABC=[{ID:23,NAME:zz},{ID:65,NAME:tt},{},{}]
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th></th>
<th><input type="checkbox" ng-model="AllChecked" /></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="x in ABC">
<td>{{x.ID}}</td>
<td>{{x.NAME}}</td>
<td><input type="checkbox" ng-model="x.selection" ng-checked="AllChecked" required /></td>
</tr>
</tbody>
Output i want:-
[{ID:x.23,Select:true},{ID:x.65,Select:true},{ID:x.ID,Select:true}]
如果我使用 for 循环,这项工作。但我不想使用循环。有没有其他方法可以帮助任何人。我尝试了 ng-change,ng-click 但仍然没有工作。
【问题讨论】:
-
您的问题是“全选”功能还是 ng-repeat 无法正常工作?
标签: angularjs angularjs-ng-checked