diff options
| author | Vojta Jina | 2013-10-22 14:41:21 -0700 |
|---|---|---|
| committer | Vojta Jina | 2013-10-22 15:32:41 -0700 |
| commit | f2fab498303e00d199cb3d19a008670e214d5c10 (patch) | |
| tree | 3aa88fdb1f63bbed45c7541232a0fdfac226c126 /src/ng/directive/input.js | |
| parent | 934a95d3ef3f72dfc37b0b564624cb4a1286d4f4 (diff) | |
| download | angular.js-f2fab498303e00d199cb3d19a008670e214d5c10.tar.bz2 | |
style: make jshint happy
Diffstat (limited to 'src/ng/directive/input.js')
| -rw-r--r-- | src/ng/directive/input.js | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index 87afc328..07b5f997 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -1,5 +1,13 @@ 'use strict'; +/* global + + -VALID_CLASS, + -INVALID_CLASS, + -PRISTINE_CLASS, + -DIRTY_CLASS +*/ + var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/; var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/; var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/; @@ -939,22 +947,22 @@ var VALID_CLASS = 'ng-valid', * <example module="badIsolatedDirective"> <file name="script.js"> angular.module('badIsolatedDirective', []).directive('bad', function() { - return { - require: 'ngModel', - scope: { }, - template: '<input ng-model="innerModel">', - link: function(scope, element, attrs, ngModel) { - scope.$watch('innerModel', function(value) { - console.log(value); - ngModel.$setViewValue(value); - }); - } - }; + return { + require: 'ngModel', + scope: { }, + template: '<input ng-model="innerModel">', + link: function(scope, element, attrs, ngModel) { + scope.$watch('innerModel', function(value) { + console.log(value); + ngModel.$setViewValue(value); + }); + } + }; }); </file> <file name="index.html"> - <input ng-model="someModel"> - <div bad ng-model="someModel"></div> + <input ng-model="someModel"> + <div bad ng-model="someModel"></div> </file> * </example> * @@ -1047,7 +1055,10 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$ * @param {boolean} isValid Whether the current state is valid (true) or invalid (false). */ this.$setValidity = function(validationErrorKey, isValid) { + // Purposeful use of ! here to cast isValid to boolean in case it is undefined + // jshint -W018 if ($error[validationErrorKey] === !isValid) return; + // jshint +W018 if (isValid) { if ($error[validationErrorKey]) invalidCount--; @@ -1127,7 +1138,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$ } catch(e) { $exceptionHandler(e); } - }) + }); } }; |
