Snippet for AngularJS for working with checkbox controls. The task is to verify if checkbox is checked or not with AngularJS.
For single checkbox the solution looks like this. I will split it into two pieces.
HTML:
<input type=”checkbox” ng-model=”modelForCheckbox” ng-click=”getCheck()” />
JAVASCRIPT:
moveApp.controller('changeDepCtrl', function ($scope, $http) {
$scope.getCheck = function () {
console.log($scope.modelForCheckbox); //if true, than checked, otherwise not checked
}
});
Leave a Reply