I want to be able to have a radio button group of two items in order to have a yes-no toggle.
The following snippet works, but has a "true"/"false" string value as item.value
<input type="radio" [formControl]="item" name="{{item.id}}" value=true>
<input type="radio" [formControl]="item" name="{{item.id}}" value=false>
How do I get an boolean value in item.value?
I tried the following without success:
<input type="radio" [formControl]="item" name="{{item.id}}" [ngValue]=true>
<input type="radio" [formControl]="item" name="{{item.id}}" [ngValue]=false>
It throws
Can't bind to 'ngValue' since it isn't a known native property
I am using Angular 2 RC4 with Angular Forms 0.2.0.
I think this is what you want:
<input type="radio" [formControl]="item" name="{{item.id}}" [value]=true>
<input type="radio" [formControl]="item" name="{{item.id}}" [value]=false>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With