Issue
I have the following form. I need the 'No' radio buttons to be selected as default. However this does not seem to work. Neither radio button is selected when I load up my page. What would cause checked to not do anything? I also used checked="checked" but that did not work either.
<form>
<label class="labelHeader bold">Nausea</label>
<input [(ngModel)]="assessment.nauseous" class="modalCheckbox inline" type="radio" name="nausea" value=true><label>Yes</label>
<input [(ngModel)]="assessment.nauseous" class="modalCheckbox inline" type="radio" name="nausea" value=false checked><label>No</label>
<label class="labelHeader bold">Headache</label>
<input [(ngModel)]="assessment.headache" class="modalCheckbox inline" type="radio" name="headache" value=true><label>Yes</label>
<input [(ngModel)]="assessment.headache" class="modalCheckbox inline" type="radio" name="headache" value=false checked><label>No</label>
</form>
Solution
It seems that you are using angular, so the html attribute checked won't work. You have to set the value inside the controller:
$scope.assessment.nauseous = false
$scope.assessment.headache = false
Answered By - cristiancastrodc
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.