Angular 2 form rerader

If I remove the form control from my form, I have a problem that the form is always wrong.

But if I remove the char from another input field and add the same char again (to create a change event), the form is valid as it should be.

How do I update a form after deleting a form control?

Many thanks

+3


source to share


1 answer


I found a solution. But I don't think this is the only way to do it.

To force the rerender process, I fix the value with the current one:



myForm.patchValue(myForm.value, {onlySelf: false, emitEvent: true});

      

+2


source







All Articles