This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
minlength validator binded to ng-model not input #12158
Labels
Milestone
Comments
The non The boolean attributes (such as The (so called) aliased attributes ( I am not implying that it is OK (nor do I know why); I am just describing how things work atm. So, a quick workaround (until this is resolved or decided to be left as is) is to use the non |
Since we try to support custom controls with |
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Aug 23, 2015
`ng-(pattern|minlength|maxlength)` directives will now validate the `ngModel` when on an element that is not an `input` or a `textarea`. The commit also adds a test for `ng-required`, although that validator worked on all elements before this fix. Fixes angular#12158
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Aug 23, 2015
`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. The commit also adds a test for `ng-required`, although that validator worked on all elements before this fix. Fixes angular#12158
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Aug 27, 2015
`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 aforementioned validators were extracted into separate directives, whereas the aliased attribute handling assumes the validators will only exist on `input|textarea` The commit also adds a test for `ng-required`, although that validator worked on all elements before this fix. Fixes angular#12158
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Aug 28, 2015
`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 angular#12158 Closes angular#12658
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Aug 31, 2015
`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 angular#12158 Closes angular#12658
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
I'm using custom directive to build my form.
Like
<my-input ng-model="vm.value" required="true" minlength="6">
This example shows that in validation required is bind to ng-model and works great. But
minlength
orng-minlength
is different - I suppose it works only withinput
tag.Can You bing
ng-minlength
withng-model
?Should I make my own validator?
The text was updated successfully, but these errors were encountered: