diff options
| author | Misko Hevery | 2010-04-07 16:36:33 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-04-07 16:36:33 -0700 |
| commit | a8aa5af413c068608aa28ef0d48cef1d5ad66485 (patch) | |
| tree | 0f58bbc59e5a0fd3a648e52546b6fd521a844a66 /angular-debug.js | |
| parent | 3d0b40fee2feeb49f46063b2012977c623f1ef6f (diff) | |
| download | angular.js-a8aa5af413c068608aa28ef0d48cef1d5ad66485.tar.bz2 | |
fixed filter this
Diffstat (limited to 'angular-debug.js')
| -rw-r--r-- | angular-debug.js | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/angular-debug.js b/angular-debug.js index e23352dd..2305bded 100644 --- a/angular-debug.js +++ b/angular-debug.js @@ -3124,7 +3124,8 @@ function valueAccessor(scope, element) { var validatorName = element.attr('ng-validate') || NOOP, validator = compileValidator(validatorName), required = element.attr('ng-required'), - lastError; + lastError, + invalidWidgets = scope.$invalidWidgets || {markValid:noop, markInvalid:noop}; required = required || required === ''; if (!validator) throw "Validator named '" + validatorName + "' not found."; function validate(value) { @@ -3132,6 +3133,10 @@ function valueAccessor(scope, element) { if (error !== lastError) { elementError(element, NG_VALIDATION_ERROR, error); lastError = error; + if (error) + invalidWidgets.markInvalid(element); + else + invalidWidgets.markValid(element); } return value; } @@ -3339,7 +3344,6 @@ angularWidget('NG:SWITCH', function ngSwitch(element){ } } }); - console.log(regex); var match = on.match(new RegExp(regex)); if (match) { foreach(params, function(name, index){ @@ -3438,6 +3442,21 @@ angularService("$hover", function(browser) { } }); }, {inject:['$browser']}); + +angularService("$invalidWidgets", function(){ + var invalidWidgets = []; + invalidWidgets.markValid = function(element){ + var index = indexOf(invalidWidgets, element); + if (index != -1) + invalidWidgets.splice(index, 1); + }; + invalidWidgets.markInvalid = function(element){ + var index = indexOf(invalidWidgets, element); + if (index === -1) + invalidWidgets.push(element); + }; + return invalidWidgets; +}); var browserSingleton; angularService('$browser', function browserFactory(){ if (!browserSingleton) { |
