How to set the initial value of a radio button

0 Answers 180 Views
RadioButton
Caroline
Top achievements
Rank 1
Caroline asked on 23 Oct 2023, 09:43 PM

I'm creating a form where, if some data already exists, it populates the form with that data. There is a field with three radio buttons in the form and I'm having trouble getting one of the buttons to be checked if that field has a value already. As you can see in the provided stackblitz, the form registers that the gender input has a value of female, but the radio button isn't checked.

How can I get it to be checked?

Thank you!

https://stackblitz.com/edit/angular-7fxtac?file=src%2Fapp%2Fapp.component.ts

Caroline
Top achievements
Rank 1
commented on 23 Oct 2023, 10:30 PM

Edit: disregard.. on my end, I wasn't setting the form control name, and in the stackblitz I had a typo in my string..

No answers yet. Maybe you can help?

Tags
RadioButton
Asked by
Caroline
Top achievements
Rank 1
Share this question
or