diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/widget/input.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/widget/input.js b/src/widget/input.js index e9c7208e..627aee27 100644 --- a/src/widget/input.js +++ b/src/widget/input.js @@ -6,6 +6,7 @@ var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/; var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/; var INTEGER_REGEXP = /^\s*(\-|\+)?\d+\s*$/; + /** * @ngdoc inputType * @name angular.inputType.text @@ -143,6 +144,7 @@ angularInputType('email', function() { }); }); + /** * @ngdoc inputType * @name angular.inputType.url @@ -216,6 +218,7 @@ angularInputType('url', function() { }); }); + /** * @ngdoc inputType * @name angular.inputType.list @@ -287,6 +290,7 @@ angularInputType('list', function() { }; }); + /** * @ngdoc inputType * @name angular.inputType.number @@ -356,6 +360,7 @@ angularInputType('list', function() { */ angularInputType('number', numericRegexpInputType(NUMBER_REGEXP, 'NUMBER')); + /** * @ngdoc inputType * @name angular.inputType.integer @@ -425,6 +430,7 @@ angularInputType('number', numericRegexpInputType(NUMBER_REGEXP, 'NUMBER')); */ angularInputType('integer', numericRegexpInputType(INTEGER_REGEXP, 'INTEGER')); + /** * @ngdoc inputType * @name angular.inputType.checkbox @@ -496,9 +502,9 @@ angularInputType('checkbox', function(inputElement) { widget.$parseView = function() { widget.$modelValue = widget.$viewValue ? trueValue : falseValue; }; - }); + /** * @ngdoc inputType * @name angular.inputType.radio @@ -765,15 +771,13 @@ angularWidget('input', function(inputElement){ controller: TypeController, controllerArgs: [inputElement]}); - widget.$pattern = watchElementProperty(this, widget, 'required', inputElement); watchElementProperty(this, widget, 'readonly', inputElement); watchElementProperty(this, widget, 'disabled', inputElement); - widget.$pristine = !(widget.$dirty = false); - widget.$on('$validate', function(event) { + widget.$on('$validate', function() { var $viewValue = trim(widget.$viewValue), inValid = widget.$required && !$viewValue, tooLong = maxlength && $viewValue && $viewValue.length > maxlength, @@ -796,9 +800,8 @@ angularWidget('input', function(inputElement){ forEach(['valid', 'invalid', 'pristine', 'dirty'], function(name) { widget.$watch('$' + name, function(scope, value) { - inputElement[value ? 'addClass' : 'removeClass']('ng-' + name); - } - ); + inputElement[value ? 'addClass' : 'removeClass']('ng-' + name); + }); }); inputElement.bind('$destroy', function() { @@ -849,4 +852,3 @@ function watchElementProperty(modelScope, widget, name, element) { }); } } - |
