mercredi 7 janvier 2015

Angular Js - Checkbox model not toggling on ng-change?

I have a simple checkbox like this:



<input type="checkbox" name="userGroup" ng-model="selectedAll" ng-change="selectAll();"></input>


I'm initiating the selectedAll model to false in my controller. In my selectAll() function, I log the value of the flag. But it stays false, doesn't update when I check and uncheck the checkbox. Any reason and solution for this?


Update:


My controller's code:



$scope.selectedAll = false;

$scope.selectAll = function() {
console.log($scope.selectedAll);
}




Aucun commentaire:

Enregistrer un commentaire