From a8aa5af413c068608aa28ef0d48cef1d5ad66485 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 7 Apr 2010 16:36:33 -0700 Subject: fixed filter this --- angular-debug.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'angular-debug.js') 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) { -- cgit v1.2.3