Home > Net >  Radio buttons not showing at first page load
Radio buttons not showing at first page load

Time:09-15

Have you any idea why the radio buttons are not showing when the page loads? I am using angular material mat-radio-buttons.

Radio buttons

CODE

CodePudding user response:

You've added formControlName to both mat-radio-group and mat-radio-button elements, while it should only be added to the mat-radio-group:

<mat-radio-group
  aria-labelledby="example-radio-group-label"
  
  formControlName="seasonsForm"
>
  <mat-radio-button
    
    *ngFor="let season of seasons"
    [value]="season"
  >
    {{ season }}
  </mat-radio-button>
</mat-radio-group>

StackBlitz

  • Related