I need to have the first value "none" checked as default and then unchecked when any of the other options are checked. I have found the way to do this using the ng-model but I'm using ng-model to build an object for email. Is there a way that I can do this using an angularish style?
<div class="activate-mail-subsection">
<label>Allergies</label><br>
<div class="checkbox mailorder-checkbox">
<input name="allergies" class="checkbox" type="checkbox" ng-model="mailorder.allergies.none" tabindex="1"/> None
</div>
<div class="checkbox mailorder-checkbox">
<input name="allergies" class="checkbox" type="checkbox" ng-model="mailorder.allergies.codeine" tabindex="1"/> Codeine
</div>
<div class="checkbox mailorder-checkbox">
<input name="allergies" class="checkbox" type="checkbox" ng-model="mailorder.allergies.sulfa" tabindex="1"/> Sulfa
</div>
<div class="checkbox mailorder-checkbox">
<input name="allergies" class="checkbox" type="checkbox" ng-model="mailorder.allergies.asprin" tabindex="1"/> Asprin
</div>
<div class="checkbox mailorder-checkbox">
<input name="allergies" class="checkbox" type="checkbox" ng-model="mailorder.allergies.penicillin" tabindex="1"/> Penicillin
</div>
<div class="checkbox mailorder-checkbox">
<label>Other</label>
<input name="allergies" class="form-control health-profile-text" type="text" ng-model="mailorder.allergies.other" tabindex="1"/>
</div>
</div>
Here is the object
$scope.mailorder = {
allergies: {none: true, codeine: false, sulfa: false, aspirin: false, penicillin: false, other: ''},
};
Aucun commentaire:
Enregistrer un commentaire