angular - Radio button for boolean property -
i have simple boolean property valid
in object document
, need bind radio-inputs.
this have far:
<input type="radio" name="valid" id="validtrue" (click)="document.valid = true" [checked]="document.valid"/> <input type="radio" name="valid" id="validfalse" (click)="document.valid = false" [checked]="!document.valid"/>
at least setting property on click works state no displayed radio-inputs. looking in developer console of browser found out property ng-reflect-checked
set doesnt seem have impact on html radio-input.
what doing wrong?
have working "angular2-boolean-radio-input" snippet?
in new forms module might want
<input type="radio" name="food" [(ngmodel)]="document.valid" [value]="true"> <input type="radio" name="food" [(ngmodel)]="document.valid" [value]="false">
Comments
Post a Comment