Skip to content Skip to sidebar Skip to footer

Detect If Checkbox Is Checked Or Unchecked In Angular.js Ng-change Event

I want to detect if a checkbox has been checked or unchecked when a click is happening on the checkbox. This is what I have: Copy

and

$scope.stateChanged = function (qId) {
   if($scope.answers[qId]){ //If it is checked
       alert('test');
   }
}

Solution 2:

The state of the checkbox will be reflected on whatever model you have it bound to, in this case, $scope.answers[item.questID]

Post a Comment for "Detect If Checkbox Is Checked Or Unchecked In Angular.js Ng-change Event"