mercredi 14 juillet 2021

Angular formArray of mat-checkbox using enum

I'm using a reactive form with a formArray of statuses which is an enum. I have a checkbox for each enum value. I tried to make it work (see link below) but the problem is that the formArray outputs [false, true, false] which makes sense because the formControl for a checkbox accepts only booleans.

enter image description here

Is there another way to have a result like this ['DRAFT', 'NEW', 'PLANNED'] containing the ones that are checked? Or should I go another direction?

See CodeSandbox for the code.

Thanks.




Aucun commentaire:

Enregistrer un commentaire