0
<div class="form-check-inline">
  <label class="form-check-label">
    <input type="radio" class="form-check-input" checked="checked" name="radio" [(ngModel)]="radio" [value]="true">Actif
  </label>
</div>
<div class="form-check-inline">
  <label class="form-check-label">
    <input type="radio" class="form-check-input" name="radio" [(ngModel)]="radio" [value]="false">Désactivé
  </label>
</div>

I want to set the Default checked on radio button but its not working with [(ngModel)].

Walter Luszczyk
  • 1,369
  • 2
  • 19
  • 36
fahad ali
  • 154
  • 1
  • 4
  • 14

1 Answers1

0

Input type radio value can be string, number or boolean. For default check a radio button the value of ngModel and value attribute of radio input should be equal.

for example.

typescript: radio=true; html: [value]="true"

typescript: radio='ABC'; html: [value]="'ABC'"

typescript: radio=999; html: [value]="999"

Chatar Singh
  • 943
  • 9
  • 13