-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(forms): handle standalone
<form>
tag correctly in `NgControlSta…
…tusGroup` directive (#40344) The `NgControlStatusGroup` directive is shared between template-driven and reactive form modules. In cases when only reactive forms module is present, the `NgControlStatusGroup` directive is still activated on all `<form>` elements, but if there is no other reactive directive applied (such as `formGroup`), corresponding `ControlContainer` token is missing, thus causing exceptions (since `NgControlStatusGroup` directive relies on it to determine the status). This commit updates the logic to handle the case when no `ControlContainer` is present (effectively making directive logic a noop in this case). Alternative approach (more risky) worth considering in the future is to split the `NgControlStatusGroup` into 2 directives with different set of selectors and include them into template-driven and reactive modules separately. The downside is that these directives might be activated simultaneously on the same element (e.g. `<form>`), effectively doing the work twice. Resolves #38391. PR Close #40344
- Loading branch information
1 parent
fcbf714
commit b3f322f
Showing
2 changed files
with
61 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters