-1

Can anyone help to figure out 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}]

This work if i use for loop. But i do not want to use loop. Is there any other way any one can hep.I tried with ng-change, ng-click but still didn't work.

1
  • Is your issue with the "select all" functionality or with the ng-repeat not working as you want? Commented Feb 1, 2018 at 21:59

1 Answer 1

0

I'm not sure if your issue lies with the select all functionality not working or the ng-repeat over your array.

And i guess you want your object to become like this: [{ID:23,NAME:zz, checked: true},{ID:65,NAME:tt, checked: true},etc]

If thats the case, check this plunker for the solution.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.