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

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.

2
  • 1
    you should reset the value of ccp on change of selected option, set it to false if its invisible Commented Sep 26, 2016 at 8:31
  • Hard to check this without a fiddle, have you tried to access the value without ".val", because "select" should already hold the value. ng-show="select == 1 || select == 2" Commented Sep 26, 2016 at 8:34

1 Answer 1

1

Use ng-change

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


//controller
$scope.selectChanged = function() {
  if (/* Insert the condition you want to set cpp to false here */) ccp = false;
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for Solution

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.