0

I have AngularJs code where i want a radio button to be automatically selected and another radio button unselected whenever a user selects a checkbox and then a specific option from a dropdown. enter image description here

So from the picture above, if a user selects the pacing checkbox then selects evenly from the dropdown, the 'Specific timezone' radio button should be automatically selected. Depending of the order of the button selections, there is also times when if pacing and evenly are selected first then the Dayparting checkbox is selected, the 'Users timezone' radio button will be selected and evenly will no longer be selected in the dropdown

<div class="radio radio-primary radio-specific">
  <input name="timezone" id="specific_time" type="radio" checked="checked"
         ng-click="specificTimezone = true;$ctrl.specificTimezoneRadioClicked()">
  <label for="specific_time">Specific timezone</label>
</div>


<input ng-if="!$ctrl.isDeliveryPacingFeatureEnabled"
    name="timezone" id="user_time" type="radio" checked="checked"
    value="viewer"
    ng-model="$ctrl.deal.deal_settings.dayparting.timezone"
    ng-click="specificTimezone = false">

I use the below line to disable the 'User timezone' radio button

ng-disabled="$ctrl.pacingEnabled() && $ctrl.evenlyPacingEnabled()"

1 Answer 1

1

What you are looking for is ng-change You can read the documentation here.

<select type="text" class="form-control" style="width:25%" ng-model="selectedVal" ng-change="changeOption()">
  <option ng-repeat="lookup in optionsList" ng-value="lookup">
    {{lookup}}
  </option>
</select>

Hope this jsfiddle link will give you a head start.

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

1 Comment

Thank you , i will give this a try now

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.