I am trying to get radio button checked or un checked based on flag status, though it is alsways checked for first radio button ffor below code
<label class="col-md-5 control-label">Active?</label>
<div class="col-md-6">
<label class="radio-inline">
<input type="radio" name="activeFlag" id="active" value="active" ng-checked="{{flag}}"> True
</label>
<label class="radio-inline">
<input type="radio" name="activeFlag" id="deactive" value="deactive" ng-checked="{{!flag}}"> False
</label>
</div>
Here flag can be false or true based on input value. "Inspect Element" shows as below:
<div class="col-md-6">
<label class="radio-inline">
<input type="radio" name="activeFlag" id="active" value="active" ng-checked="true" checked="checked"> True
</label>
<label class="radio-inline">
<input type="radio" name="activeFlag" id="deactive" value="deactive" ng-checked="false"> False
</label>
</div>
I dont have idea from where that checked attribute pops up . Please help.
答案 0 :(得分:2)
ngChecked
expects an Angular expression - so remove the {{}}
ng-checked="!flag"