Reputation:
I am using the following piece of code for selecting the first option for radio button, but somehow it doesn't seem to work
<label class="radio inline">
<input type="radio" ng-value="true" name="smsEnabled" ng-model="contactNumberArray.smsEnabled1" ng-checked="true">Yes
</label>
<label class="radio inline">
<input type="radio" ng-value="false" name="smsEnabled" ng-model="contactNumberArray.smsEnabled1">No
</label>
Can someone suggest some work around for this ?
Upvotes: 0
Views: 1732
Reputation: 16508
Hi in your controller you have to set default value for contactNumberArray please see here: http://jsbin.com/dafoj/1/edit
JS:
$scope.contactNumberArray ={
smsEnabled1 : true
};
HTML:
<label class="radio inline">
<input type="radio" ng-value="true" name="smsEnabled" ng-model="contactNumberArray.smsEnabled1" ng-checked="true">Yes
</label>
<label class="radio inline">
<input type="radio" ng-value="false" name="smsEnabled" ng-model="contactNumberArray.smsEnabled1">No
</label>
Upvotes: 1