0

I am trying to create a radio button input in my Angular2 app using ngModel and value. I want three options: true, false, and null, but I can't figure out how to set one of the inputs to a value of null. Essentially if nothing has been selected (ie the ngModel value is null) I want that null radio button to be selected. Is there a way to do this easily in the HTML? Thanks.

borisonr
  • 11
  • 1
  • 4

1 Answers1

0

Use binding [value]="null"

<input type="radio" id="rb-id" name="rb-name" [(ngModel)]="someVar" [value]="null">
Sworgkh
  • 56
  • 1
  • 2