diff options
| author | Shyam Seshadri | 2010-06-16 10:32:56 -0700 | 
|---|---|---|
| committer | Shyam Seshadri | 2010-06-16 10:32:56 -0700 | 
| commit | 769b26b79eb26076c218cb5b57179ee98424bbd7 (patch) | |
| tree | affc0a834a4307bc90a97f4b776d249f0508def2 /src/widgets.js | |
| parent | bbb45a7eed5264a343c191f3abfbe6f6b5d51139 (diff) | |
| download | angular.js-769b26b79eb26076c218cb5b57179ee98424bbd7.tar.bz2 | |
Fix bug with validator not triggering when attributes are bound and fix some typos. Add test for bug
Diffstat (limited to 'src/widgets.js')
| -rw-r--r-- | src/widgets.js | 16 | 
1 files changed, 8 insertions, 8 deletions
diff --git a/src/widgets.js b/src/widgets.js index 5df92de0..30a4a088 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -15,9 +15,9 @@ function modelAccessor(scope, element) {  function modelFormattedAccessor(scope, element) {    var accessor = modelAccessor(scope, element), -      farmatterName = element.attr('ng-format') || NOOP, -      formatter = angularFormatter(farmatterName); -  if (!formatter) throw "Formatter named '" + farmatterName + "' not found."; +      formatterName = element.attr('ng-format') || NOOP, +      formatter = angularFormatter(formatterName); +  if (!formatter) throw "Formatter named '" + formatterName + "' not found.";    return {      get: function() {        return formatter.format(accessor.get()); @@ -36,12 +36,12 @@ function valueAccessor(scope, element) {    var validatorName = element.attr('ng-validate') || NOOP,        validator = compileValidator(validatorName),        requiredExpr = element.attr('ng-required'), -      farmatterName = element.attr('ng-format') || NOOP, -      formatter = angularFormatter(farmatterName), +      formatterName = element.attr('ng-format') || NOOP, +      formatter = angularFormatter(formatterName),        format, parse, lastError, required;        invalidWidgets = scope.$invalidWidgets || {markValid:noop, markInvalid:noop};    if (!validator) throw "Validator named '" + validatorName + "' not found."; -  if (!formatter) throw "Formatter named '" + farmatterName + "' not found."; +  if (!formatter) throw "Formatter named '" + formatterName + "' not found.";    format = formatter.format;    parse = formatter.parse;    if (requiredExpr) { @@ -86,8 +86,8 @@ function valueAccessor(scope, element) {        var error,            validateScope = extend(new (extend(function(){}, {prototype:scope}))(), {$element:element});        error = required && !value ? -            "Required" : -            (value ? validator(validateScope, value) : null); +              'Required' : +              value ? validator(validateScope, value) : null;        elementError(element, NG_VALIDATION_ERROR, error);        lastError = error;        if (error) {  | 
