Mohammad Fareed Mohammad Fareed - 2 months ago 8
AngularJS Question

Unchecked angularJS Checkbox When Select Option CHanges

<select ng-model="select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>

when select value is 1,3 I want to show the checkbox

<input type=checkbox name="ccp" ng-model="ccp" ng-show="select.val==1 || select.val==2">

the Problem is when I select 1 then checkbox is visible, and I checked the checkbox. but when I change the select option the checkbox is invisible but its with checked. I want when I select option changes I want uncheck the checkbox.


Use ng-change

<select ng-model="select" ng-change="selectChanged()">

$scope.selectChanged = function() {
  if (/* Insert the condition you want to set cpp to false here */) ccp = false;