Closed andreanaFelicione closed 1 month ago
Please give me an online example
Here is a test project: testStackBlitz
I can't find issues about mtx-select in your demo. But I'd like to point out a few irregularities.
If you want to init the form in ngOnInit
hook, you should define the form like this.
- form!: FormGroup
+ form?: FormGroup
But I think the best way to init Reactive Form should like this.
form = this.fb.group({
test: 1
});
ngOnInit(): void {
this.form.patchValue(...)
}
Clicking the button the select should set value to "Setted Value", instead it remain with "Default Value" and shows the error "There is no FormControl instance attached to form control element with name: 'test'" in the console. How can you say you don't find any issues? This is the only component that behaves like this, all other material inputs do not cause problems with reinit of the formGroup.
PS. My entire project of thousands and thousands of lines is managed with reinitialized formGroups, the idea of modifying everything using patchValue is absolutely unthinkable.
I'm sorry, it's indeed a problem, I'll try to fix it.
The new version 17.1.4 has fixed this issue, please try again.
Perfect. It works now, thank you so much!
When reinitialize the formGroup, for example re-executing the following
I have @angular/material@17.3.1 and @ng-matero/extensions@17.1.3