I'm looking to automatically check an input checkbox when the page loads, and if it's checked, subtract its value from the total. How can I tackle this issue?
Here's the HTML snippet:
<p>{{vm.TOTAL VALUE}}</p>
<tr ng-repeat="item in items track by $index">
<td><input type="checkbox" ng-model="item.selected" ng-change="vm.checkItems(item)" ng-checked="vm.itemArray.indexOf(item.id) > -1"/></td>
<td>{{ item.SOMEVALUE}}</td>
</tr>
And here's the controller code:
vm.itemArray = [4,9,45]
vm.TOTALVALUE = "345"