Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Commit b597646

Browse files
Correction to dependencies and error checking
1 parent c0d85b0 commit b597646

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

modules/directives/validate/validate.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* @param ui-validate {string} The name of a function to be used as a validator. The function will get a value to be
1111
* validates as its argument and should return true/false indicating a validation result.
1212
*/
13-
angular.module('ui.directives').directive('uiValidate', function ($parse) {
13+
angular.module('ui.directives').directive('uiValidate', function () {
1414

1515
return {
1616
restrict:'A',
@@ -22,8 +22,8 @@ angular.module('ui.directives').directive('uiValidate', function ($parse) {
2222
return;
2323
}
2424

25-
if (!angular.isFunction(scope[validateExpr])){
26-
throw Error('uiValidate expression "'+validateExpr+'" is not a function.');
25+
if (!angular.isFunction(scope[validateExpr])) {
26+
throw Error('uiValidate expression "' + validateExpr + '" is not a function.');
2727
}
2828

2929
var validateFn = function (valueToValidate) {
@@ -39,10 +39,8 @@ angular.module('ui.directives').directive('uiValidate', function ($parse) {
3939
}
4040
};
4141

42-
if (ctrl) {
43-
ctrl.$formatters.push(validateFn);
44-
ctrl.$parsers.push(validateFn);
45-
}
42+
ctrl.$formatters.push(validateFn);
43+
ctrl.$parsers.push(validateFn);
4644
}
4745
}
4846
});

0 commit comments

Comments
 (0)