This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ngModel): let aliased validator directives work on any element
`ng(Pattern|Minlength|Maxlength)` directives will now validate the `ngModel` when on an element that is not an `input` or a `textarea`. Previously, only their HTML5 counterparts worked on every element. This is because the three validators were extracted into separate directives (see 26d91b6 and 1be9bb9), whereas the aliased attribute handling assumes the validators will only exist on `input|textarea` (see d9b90d7 and 25541c1). Since `ngMin` and `ngMax` are also aliased attributes, this means observers of `min` and `max` will be fired if `ngMin` and `ngMax` change. This will happen on any element, even if it does not have an `ngModel`. However, since min/max validators are only ever added as part of the `input[number|textarea]` types, even if the element has an `ngModel`, no validators will be added. Finally the commit also tests that `ng-required` works on any element, although that validator worked on all elements before this fix. Fixes #12158 Closes #12658
- Loading branch information
Showing
3 changed files
with
76 additions
and
4 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