javascript - How to use ng-if with radio buttons? -


this should simple question.

i'm having trouble using ng-if radio buttons. these buttons:

<label class="radio-inline">     <input type="radio" id="day_month" ng-model="day_month" name="inlineradiooptions" value="option1"> day of     month </label> <label class="radio-inline">     <input type="radio" id="day_week" ng-model="day_month" name="inlineradiooptions" value="option2"> day of     week </label> 

how can use ng-if show if first radio button selected?

the binded model day_month updated upon select value of input. checking if value equals value give possibility check whether input has been selected. please see example below.

<label class="radio-inline">     <input type="radio" id="day_month" ng-model="day_month" name="inlineradiooptions" value="option1"> day of     month </label> <label class="radio-inline" ng-show="day_month == 'option1'">     <input type="radio" id="day_week" ng-model="day_month" name="inlineradiooptions" value="option2"> day of     week </label> 

Comments