Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 6737924

Browse files
matskoIgorMinar
authored andcommitted
feat(NgModel): port the email input type to use the validators pipeline
1 parent 3ee6573 commit 6737924

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/ng/directive/input.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -1136,12 +1136,10 @@ function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
11361136
function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
11371137
textInputType(scope, element, attr, ctrl, $sniffer, $browser);
11381138

1139-
var emailValidator = function(value) {
1140-
return validate(ctrl, 'email', ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value), value);
1139+
ctrl.$validators.email = function(modelValue, viewValue) {
1140+
var value = modelValue || viewValue;
1141+
return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value);
11411142
};
1142-
1143-
ctrl.$formatters.push(emailValidator);
1144-
ctrl.$parsers.push(emailValidator);
11451143
}
11461144

11471145
function radioInputType(scope, element, attr, ctrl) {

0 commit comments

Comments
 (0)