-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Conversation
Makes it possible to: - disable the registration of a form in its parent form by specifying an empty or falsy value (preventing the propagation of validation, dirtiness and so on) - specify a custom parent form (that is not necessarily the parent in the DOM) via an Angular expression that is evaluated in the current scope If the parameter is not specified, the form directive will traverse up the DOM to locate a parent form as before this change, so current implementations will not break.
A known problem with this commit at the moment is that specifying a custom parent form does not work if the form is not available yet (e.g., if the referenced form is located later in the DOM than the form that references it). Not sure how to deal with this yet, or if using |
I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS. Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match. If you signed the CLA as a corporation, please let us know the company's name. Thanks a bunch! PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR. |
Specifying a non-DOM-parent parent seems very unusual to me... What circumstances make that necessary? |
CLA signature verified! Thank you! Someone from the team will now triage your PR and it will be processed based on the determined priority (doc updates and fixes with tests are prioritized over other changes). |
@MikeMcElroy I think the use cases for this feature will have very practical reasons behind them. In my case, where I would set the parent as empty, it's custom date pickers and color pickers that have their own mini form and should not propagate their $dirty state to the parent form. They are nested in the main form because they have separate instances for every field that uses a picker, and because it's easy to do the positioning with CSS this way. It works the other way around as well, someone may have a form that needs to propagate its dirtiness or validity to another, without it being a parent element in the DOM. |
Btw, I'm also OK with the original solution proposed in #5858 where we would just have an attribute that says "don't propagate anything to the parent form", if the concept of setting a custom parent is too confusing or unnecessary. Let's hear some opinions. |
CLA signature verified! Thank you! Someone from the team will now triage your PR and it will be processed based on the determined priority (doc updates and fixes with tests are prioritized over other changes). |
related #5037 |
02dc2aa
to
fd2d6c0
Compare
👍 |
cad9560
to
f294244
Compare
e8dc429
to
e83fab9
Compare
4dd5a20
to
998c61c
Compare
This is worked on in a more comprehensive fashion here: #10193 |
Makes it possible to:
If the parameter is not specified, the form directive will traverse up the DOM to locate a parent form as before this change, so current implementations will not break. This fixes issue #5858.