I use mat-checkbox within angular application. Globally my issue is the following: I have a formGroup including a mat-checkbox and a text input field. When I click on the mat-checkbox, I instanciate a new FormGroup with the same fields as previous, plus another text field. The value of the mat-checkbox is true and it is checked. Then, I click again on the checkbox to uncheck it and instanciate again the first FormGroup, but it stays checked while it should be unchecked
Here is the demo: (https://stackblitz.com/edit/angular-dy7s9u?file=src%2Fapp%2Fapp.component.html)
Apply following steps: 1) enter "Dupont" as name -> OK
2) check the box. The state of the box is checked. The value of the formControlName is true. The adresse field appear. -> OK
3) enter an adress (for example "19 Christchurch Road") -> OK
4) uncheck again the mat-checkbox. -> NOT OK the state of the mat-checkbox should become unchecked with a value false for the FormControlName and it is the contrary
Aucun commentaire:
Enregistrer un commentaire