-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvalidate.js
More file actions
31 lines (27 loc) · 795 Bytes
/
validate.js
File metadata and controls
31 lines (27 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* angular-validate-directive
* (c) 2014 Google
* License: Apache 2.0
*/
'use strict';
angular.module('dbrans.validate', ['ng']).
directive('dbransValidate', function() {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, elem, attr, ngModelController) {
var moreValidators = scope.$eval(attr.dbransValidate);
angular.extend(ngModelController.$validators, moreValidators);
}
};
}).
directive('dbransValidateAsync', function() {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, elem, attr, ngModelController) {
var moreValidators = scope.$eval(attr.dbransValidateAsync);
angular.extend(ngModelController.$asyncValidators, moreValidators);
}
};
});