I think I'm trying to do something relatively simple in Angular but for some reason I can't get my head perfectly around ngClick, ngModel, ngChange or ngChecked to solve it.
I have a whole bunch of repeated checkboxes and when one is checked, a function alerts one thing and when its unchecked, the function alerts a different thing. Here's some pseudo code:
HTML:
<div id="topic" ng-repeat="50 times">
<input type='checkbox' ng-model='???' ng-click='myFunc($index)' />
</div>
Script:
function myFunc(index) {
if (checkbox == checked) {
alert('checkbox ' + index + 'checked!');
}
else {
alert('checkbox' + index + 'unchecked!');
}
}
So the problem is I can't figure out how to tell which checkbox in the repeat is checked and when it's unchecked. Anyone any ideas?