-
Notifications
You must be signed in to change notification settings - Fork 27.4k
FormController $setValidity documentation: signature doesn't match implementation signature #15963
Comments
I was about to update the docs, when I realized I don't know any good usecase for this method. It updates the validity on a form (and parent forms), but without affecting the control. Has anyone used this or has ideas on how this could be useful? |
@gkalpak Could it be that this issue is about what you're saying? #13202 The issue is mentioning it's not doing anything with the controls/childs. Looks like the same as you're saying. Looks like the usecases for the method (using the current implementation) are limited, however I'd say having a |
We should probably update the docs regardless of any considerations about setting child form validity. The whole form / model API is messy in this regard. It looks like this function is only useful in propagating the state of a control (ngModel) to its parent form(s). A form method that sets the validity of its controls (and its child forms and so on) must probably be a new function. Or could be implemented by exposing the child forms / controls: #14749 |
It is the child controller (the one that has/had the error).
Not sure what you mean. This function is for updating the error/validity of a form (based on that of a child controller; TBH, I only see this being useful for internal use (i.e. to be called from the control's |
I think we mean the same. $setValidity is usually called when a child control (ngModel) changes validity and informs the parent form. We still can add the info that this is a function for internal use (as it has been exposed in the API for a long time) |
Yeah, we probably mean the same. (But I would like to point out that there are two different OOC, @fixermark do you have a usecase for |
We have a situation where we are using a directive to modify the validity of a form element, and as a side-effect of checking the validity of that element, we also need to modify the validity of a second element that determines its validity based on the value of the first element. |
Uh oh!
There was an error while loading. Please reload this page.
I'm submitting a ...
Current behavior:
Documentation for $setValidity shows its signature as
$setValidity();
Implementation actually takes three arguments: the validation error key, the state to set the key to, and a "controller" third argument that (based on how it's used) appears to be the controller for the edit form.
Expected / new behavior:
Please update documentation to match implementation. A code snippet would also help to clarify the meaning of the arguments.
Angular version: master branch
The text was updated successfully, but these errors were encountered: