0

html

<input id="cAllBtn" type="checkbox" ng-model="checkAll"  />

<div ng-repeat="u in $ctrl.usersList" >
 <input type="checkbox" ng-checked="checkAll" ng-model="u.selected"   />
</div>

relevent part in ctrl

usersList = [selected:false,selected:false]

when i click cAllBtn all cbxs in ng-repeat are marked but array not updating what to do?

david
  • 39
  • 1
  • 6
  • According to the Official Documentation, you shouldn't use `ng-checked` and `ng-model` on the same element. https://docs.angularjs.org/api/ng/directive/ngChecked – Claies Jun 26 '18 at 22:45
  • so what th solution? – david Jun 26 '18 at 22:53
  • there is a potential solution in the marked duplicate. For what you are trying to do, instead of `checkAll` being a separate property, your check all should call a function that sets the value of all the relevant array elements in the controller. – Claies Jun 26 '18 at 22:55

0 Answers0