I have HTML like this:
<input ng-controller="cboxCtrl" type="checkbox"
ng-model="hideCompleted" ng-change="hideChanged()"/>
and such a controller:
angular.module('simple-todos').controller('cboxCtrl', ['$scope',
function ($scope) {
console.log("starting");
$scope.hideChanged = function () {
console.log("in hideChanged() ");
};
}]);
It works fine and I see a message on the console when I click this checkbox. However, if I add a label around the check box:
<label>
<input ng-controller="cboxCtrl" type="checkbox"
ng-model="hideCompleted" ng-change="hideChanged()"/>
Some text to explain the checkbox
</label>
The ng-change function does not start when I check the box. I expect this to be related to the definition of the field of view, but I cannot understand that. If I replace the labels with a div (which, of course, does not give a "nice" laýout), the ng-change function executes again as expected.
source
share