Question

I have a series of checkboxes:

 <input type="checkbox" ng-change="??????">

I need to set $scope.mode.someOtherValue = false if the checkbox is true.

Is there a way to get the value of the checkbox in the ng-change so that I can use it to set the value of $scope.mode.someOtherValue

Was it helpful?

Solution

Try this:

In HTML;

<input type="checkbox" ng-model="CheckValue" ng-true-value="true" ng-false-value="false" ng-change="valueChanged()">

In JS;

$scope.valueChanged = function(){
  if($scope.CheckValue == true){
    $scope.mode.someOtherValue = false;
  }else{
    $scope.mode.someOtherValue = true;
  }
}

Hope it helps...!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top