Closed adrianriepl closed 4 years ago
You're welcome to submit a PR.
markAllAsTouched()
is only available since Angular 8.0.0, so the project would need to be updated to at least this version. So there might be some more changes than just adding the above mentioned methods.
You can do it yourself without upgrading anything.
You can also add markAllAsDirty
.
Okay then I'll do it without upgrading it. I'll do a PR as soon as I find some time.
I tried to implement the mark* methods but I am struggling a little bit. Maybe I made a mistake somewhere or have a misunderstanding how the library is structured. I have the following problem:
markAllAsTouched()
I'll get the error => core.js:4117 ERROR TypeError: this._forEachChild is not a function at Object.push../node_modules/@angular/forms/__ivy_ngcc__/fesm5/forms.js.AbstractControl.markAllAsTouched (forms.js:2951)
markAsDirty()
the property of the control does not change.Can somebody help me out?
You can't call https://github.com/adrianriepl/forms-manager/blob/master/projects/ngneat/forms-manager/src/lib/forms-manager.ts#L261. As you said, it is only available since Angular 8.0.0.
You should do something like https://stackoverflow.com/a/44150793/7330592
I forked the library after the last commit (where it was changed to Angular 9.1.11) so it should be available already or am I not seeing something?
You are right. When do you see the error?
You will see the error when you click on the save button in the demo application. Here I call this.manager.markAllAsTouched('stepOne')
.
I'll check it later. But try to debug it. Add a debugger statement and see why you get the error.
Would it make sense to add support the
mark*()
methods for a form or a control?The methods could be called like
formsManager.patchValue()
: