Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(forms): export forms utility functions: isFormArray, isFormGroup… (
#47718) This commit exports existing utility functions to check for control instances: isFormControl, isFormGroup, isFormRecord, isFormArray Those are useful when implementing validators that use the specifics of one of those control types. To narrow down the type to what it actually is, we can now use the util functions in validators: ``` export const myArrayValidator: ValidatorFn = (control) => { if (!isFormArray(control)) { return null; } // now you can use FormArray-specific members, e.g.: if (control.controls.every(c => !!c.value) { return { myerror: true } } else { return null; } } ``` PR Close #47718
- Loading branch information
1 parent
c0c7efa
commit a8569e3
Showing
5 changed files
with
39 additions
and
3 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
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
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