1

example

In the example above, the radio buttons below the checkbox are activated when the checkbox is checked. I'd like to reset the radio buttons (so that no radio button is filled) when unchecking this checkbox.

<div class="checkbox checkbox-info">
  <input id="icb" type="checkbox" ng-model="checked">
  <label for="icb"><i class="fa fa-refresh">&nbsp;</i><b>Integratie</b></label>
</div>
<div class="radio">
  <input type="radio" name="irb" id="iarb" ng-disabled="!checked" value="!checked">
  <label for="iarb">Administrator</label>
</div>
<div class="radio">
  <input type="radio" name="irb" id="imrb" ng-disabled="!checked" value="!checked">
  <label for="imrb">Medewerker</label>
</div>

1 Answer 1

1

Change radio button value to ng-model

HTML

<div class="checkbox checkbox-info">
      <input id="icb" type="checkbox" ng-model="checked" ng-click="onCheck()">
      <label for="icb"><i class="fa fa-refresh">&nbsp;</i><b>Integratie</b></label>
</div>

    <div class="radio">
      <input type="radio" name="irb" id="imrb" ng-model="radio_checked" value="1" ng-disabled="!checked" />

      <label for="iarb">Administrator</label>
    </div>
    <div class="radio"> 
    <input type="radio" name="irb" id="imrb" ng-model="radio_checked" value="2" ng-disabled="!checked" />

      <label for="imrb">Medewerker</label>
    </div> 

JS

$scope.onCheck = function(){
    $scope.radio_checked = false;    
 }

Demo Fiddle

Sign up to request clarification or add additional context in comments.

1 Comment

Follow-up question: what do I need to add so that the first radio button is selected when the checkbox is checked?

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.