aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/services.js2
-rw-r--r--src/validators.js2
-rw-r--r--src/widgets.js9
3 files changed, 8 insertions, 5 deletions
diff --git a/src/services.js b/src/services.js
index 1d3ba006..d98c0876 100644
--- a/src/services.js
+++ b/src/services.js
@@ -165,14 +165,12 @@ angularService('$route', function(location, params){
}
};
function updateRoute(){
- console.log('updating route');
var childScope;
$route.current = null;
angular.foreach(routes, function(routeParams, route) {
if (!childScope) {
var pathParams = matcher(location.hashPath, route);
if (pathParams) {
- console.log('new route', routeParams.template, location.hashPath, location.hash);
childScope = angular.scope(parentScope);
$route.current = angular.extend({}, routeParams, {
scope: childScope,
diff --git a/src/validators.js b/src/validators.js
index 27b4b404..81d40264 100644
--- a/src/validators.js
+++ b/src/validators.js
@@ -117,7 +117,7 @@ foreach({
element.removeClass('ng-input-indicator-wait');
scope.$invalidWidgets.markValid(element);
}
- element.data('$validate')(input);
+ element.data('$validate')();
scope.$root.$eval();
});
} else if (inputState.inFlight) {
diff --git a/src/widgets.js b/src/widgets.js
index 2909aed1..828e6d24 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -27,6 +27,11 @@ function valueAccessor(scope, element) {
required = required || required === '';
if (!validator) throw "Validator named '" + validatorName + "' not found.";
function validate(value) {
+ var force = false;
+ if (isUndefined(value)) {
+ value = element.val();
+ force = true;
+ }
if (element[0].disabled || isString(element.attr('readonly'))) {
elementError(element, NG_VALIDATION_ERROR, null);
invalidWidgets.markValid(element);
@@ -36,8 +41,8 @@ function valueAccessor(scope, element) {
validateScope = extend(new (extend(function(){}, {prototype:scope}))(), {$element:element});
error = required && !trim(value) ?
"Required" :
- validator({state:validateScope, scope:{get:validateScope.$get, set:validateScope.$set}}, value);
- if (error !== lastError) {
+ (trim(value) ? validator({state:validateScope, scope:{get:validateScope.$get, set:validateScope.$set}}, value) : null);
+ if (error !== lastError || force) {
elementError(element, NG_VALIDATION_ERROR, error);
lastError = error;
if (error)