mercredi 14 janvier 2015

Can't use ngChange in ngRepeat - Angularjs

I am using ngRepeat to generate a fieldset of checkboxes.


I do this as follows:



<fieldset id="country_select" ng-controller="CountriesListController">
<span ng-repeat="country in countries">
<label>
<input type="checkbox" id="country.name" ng-change="locationAdd(country.name)">
{{country.name}}
</label><br/>
</span>
</fieldset>


However for some reason adding the ngChange directive to my checkbox causes my ng-repeat output to display only one checkbox as follows:


checkbox {{country.name}}


When I change ngChange to ngClick my ngRepeat loop works.


So my question is: Why does ngChange not work with ngRepeat but ngClick does when inserted into my checkbox input





Aucun commentaire:

Enregistrer un commentaire