diff options
| author | Misko Hevery | 2010-04-08 15:05:05 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-04-08 15:05:05 -0700 |
| commit | 41a5c408c242269bf31bc0b774c7304fdf7c2f1c (patch) | |
| tree | aa48e2eff595691b4f4ee07d0307fcd95ebd0956 /src/widgets.js | |
| parent | c4ef1f2fdd73bdaeda879e596d3d96e4e68cb6fd (diff) | |
| download | angular.js-41a5c408c242269bf31bc0b774c7304fdf7c2f1c.tar.bz2 | |
tests pass jstd has issues
Diffstat (limited to 'src/widgets.js')
| -rw-r--r-- | src/widgets.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/widgets.js b/src/widgets.js index faa60043..f87c1d02 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -22,20 +22,18 @@ function valueAccessor(scope, element) { var validatorName = element.attr('ng-validate') || NOOP, validator = compileValidator(validatorName), required = element.attr('ng-required'), - lastError, lastVisible, + lastError, invalidWidgets = scope.$invalidWidgets || {markValid:noop, markInvalid:noop}; required = required || required === ''; if (!validator) throw "Validator named '" + validatorName + "' not found."; function validate(value) { var error = required && !trim(value) ? "Required" : - validator({state:scope, scope:{get:scope.$get, set:scope.$set}}, value), - visible = isVisible(element); - if (error !== lastError || visible !== lastVisible) { + validator({state:scope, scope:{get:scope.$get, set:scope.$set}}, value); + if (error !== lastError) { elementError(element, NG_VALIDATION_ERROR, error); lastError = error; - lastVisible = visible; - if (error && visible) + if (error) invalidWidgets.markInvalid(element); else invalidWidgets.markValid(element); |
