angularjs-rails 1.2.7 → 1.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.2.7
2
+ * @license AngularJS v1.2.9
3
3
  * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.2.7
2
+ * @license AngularJS v1.2.9
3
3
  * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -68,7 +68,7 @@ function minErr(module) {
68
68
  return match;
69
69
  });
70
70
 
71
- message = message + '\nhttp://errors.angularjs.org/1.2.7/' +
71
+ message = message + '\nhttp://errors.angularjs.org/1.2.9/' +
72
72
  (module ? module + '/' : '') + code;
73
73
  for (i = 2; i < arguments.length; i++) {
74
74
  message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
@@ -271,7 +271,8 @@ function isArrayLike(obj) {
271
271
  * is the value of an object property or an array element and `key` is the object property key or
272
272
  * array element index. Specifying a `context` for the function is optional.
273
273
  *
274
- * Note: this function was previously known as `angular.foreach`.
274
+ * It is worth nothing that `.forEach` does not iterate over inherited properties because it filters
275
+ * using the `hasOwnProperty` method.
275
276
  *
276
277
  <pre>
277
278
  var values = {name: 'misko', gender: 'male'};
@@ -1833,11 +1834,11 @@ function setupModuleLoader(window) {
1833
1834
  * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
1834
1835
  */
1835
1836
  var version = {
1836
- full: '1.2.7', // all of these placeholder strings will be replaced by grunt's
1837
+ full: '1.2.9', // all of these placeholder strings will be replaced by grunt's
1837
1838
  major: 1, // package task
1838
1839
  minor: 2,
1839
- dot: 7,
1840
- codeName: 'emoji-clairvoyance'
1840
+ dot: 9,
1841
+ codeName: 'enchanted-articulacy'
1841
1842
  };
1842
1843
 
1843
1844
 
@@ -3399,7 +3400,7 @@ function annotate(fn) {
3399
3400
  * constructor function that will be used to instantiate the service instance.
3400
3401
  *
3401
3402
  * You should use {@link AUTO.$provide#methods_service $provide.service(class)} if you define your service
3402
- * as a type/class. This is common when using {@link http://coffeescript.org CoffeeScript}.
3403
+ * as a type/class.
3403
3404
  *
3404
3405
  * @param {string} name The name of the instance.
3405
3406
  * @param {Function} constructor A class (constructor function) that will be instantiated.
@@ -3407,20 +3408,25 @@ function annotate(fn) {
3407
3408
  *
3408
3409
  * @example
3409
3410
  * Here is an example of registering a service using
3410
- * {@link AUTO.$provide#methods_service $provide.service(class)} that is defined as a CoffeeScript class.
3411
+ * {@link AUTO.$provide#methods_service $provide.service(class)}.
3411
3412
  * <pre>
3412
- * class Ping
3413
- * constructor: (@$http) ->
3414
- * send: () =>
3415
- * @$http.get('/ping')
3416
- *
3417
- * $provide.service('ping', ['$http', Ping])
3413
+ * $provide.service('ping', ['$http', function($http) {
3414
+ * var Ping = function() {
3415
+ * this.$http = $http;
3416
+ * };
3417
+ *
3418
+ * Ping.prototype.send = function() {
3419
+ * return this.$http.get('/ping');
3420
+ * };
3421
+ *
3422
+ * return Ping;
3423
+ * }]);
3418
3424
  * </pre>
3419
3425
  * You would then inject and use this service like this:
3420
3426
  * <pre>
3421
- * someModule.controller 'Ctrl', ['ping', (ping) ->
3422
- * ping.send()
3423
- * ]
3427
+ * someModule.controller('Ctrl', ['ping', function(ping) {
3428
+ * ping.send();
3429
+ * }]);
3424
3430
  * </pre>
3425
3431
  */
3426
3432
 
@@ -6648,7 +6654,7 @@ function directiveNormalize(name) {
6648
6654
  *
6649
6655
  *
6650
6656
  * @param {string} name Normalized element attribute name of the property to modify. The name is
6651
- * revers translated using the {@link ng.$compile.directive.Attributes#$attr $attr}
6657
+ * reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr}
6652
6658
  * property to the original name.
6653
6659
  * @param {string} value Value to set the attribute to. The value can be an interpolated string.
6654
6660
  */
@@ -6786,8 +6792,7 @@ function $ControllerProvider() {
6786
6792
  * @requires $window
6787
6793
  *
6788
6794
  * @description
6789
- * A {@link angular.element jQuery (lite)}-wrapped reference to the browser's `window.document`
6790
- * element.
6795
+ * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.
6791
6796
  */
6792
6797
  function $DocumentProvider(){
6793
6798
  this.$get = ['$window', function(window){
@@ -6946,9 +6951,9 @@ function $HttpProvider() {
6946
6951
  common: {
6947
6952
  'Accept': 'application/json, text/plain, */*'
6948
6953
  },
6949
- post: CONTENT_TYPE_APPLICATION_JSON,
6950
- put: CONTENT_TYPE_APPLICATION_JSON,
6951
- patch: CONTENT_TYPE_APPLICATION_JSON
6954
+ post: copy(CONTENT_TYPE_APPLICATION_JSON),
6955
+ put: copy(CONTENT_TYPE_APPLICATION_JSON),
6956
+ patch: copy(CONTENT_TYPE_APPLICATION_JSON)
6952
6957
  },
6953
6958
 
6954
6959
  xsrfCookieName: 'XSRF-TOKEN',
@@ -7126,7 +7131,15 @@ function $HttpProvider() {
7126
7131
  * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }.
7127
7132
  *
7128
7133
  * The defaults can also be set at runtime via the `$http.defaults` object in the same
7129
- * fashion. In addition, you can supply a `headers` property in the config object passed when
7134
+ * fashion. For example:
7135
+ *
7136
+ * ```
7137
+ * module.run(function($http) {
7138
+ * $http.defaults.headers.common.Authentication = 'Basic YmVlcDpib29w'
7139
+ * });
7140
+ * ```
7141
+ *
7142
+ * In addition, you can supply a `headers` property in the config object passed when
7130
7143
  * calling `$http(config)`, which overrides the defaults without changing them globally.
7131
7144
  *
7132
7145
  *
@@ -7150,7 +7163,9 @@ function $HttpProvider() {
7150
7163
  * properties. These properties are by default an array of transform functions, which allows you
7151
7164
  * to `push` or `unshift` a new transformation function into the transformation chain. You can
7152
7165
  * also decide to completely override any default transformations by assigning your
7153
- * transformation functions to these properties directly without the array wrapper.
7166
+ * transformation functions to these properties directly without the array wrapper. These defaults
7167
+ * are again available on the $http factory at run-time, which may be useful if you have run-time
7168
+ * services you wish to be involved in your transformations.
7154
7169
  *
7155
7170
  * Similarly, to locally override the request/response transforms, augment the
7156
7171
  * `transformRequest` and/or `transformResponse` properties of the configuration object passed
@@ -7364,7 +7379,8 @@ function $HttpProvider() {
7364
7379
  * for added security.
7365
7380
  *
7366
7381
  * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName
7367
- * properties of either $httpProvider.defaults, or the per-request config object.
7382
+ * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,
7383
+ * or the per-request config object.
7368
7384
  *
7369
7385
  *
7370
7386
  * @param {object} config Object describing the request to be made and how it should be
@@ -7927,7 +7943,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
7927
7943
  } else {
7928
7944
  completeRequest(callback, status || -2);
7929
7945
  }
7930
- delete callbacks[callbackId];
7946
+ callbacks[callbackId] = angular.noop;
7931
7947
  });
7932
7948
  } else {
7933
7949
 
@@ -7944,7 +7960,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
7944
7960
  // response is in the cache. the promise api will ensure that to the app code the api is
7945
7961
  // always async
7946
7962
  xhr.onreadystatechange = function() {
7947
- // onreadystatechange might by called multiple times with readyState === 4 on mobile webkit caused by
7963
+ // onreadystatechange might get called multiple times with readyState === 4 on mobile webkit caused by
7948
7964
  // xhrs that are resolved while the app is in the background (see #5426).
7949
7965
  // since calling completeRequest sets the `xhr` variable to null, we just check if it's not null before
7950
7966
  // continuing
@@ -7957,11 +7973,12 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
7957
7973
 
7958
7974
  if(status !== ABORTED) {
7959
7975
  responseHeaders = xhr.getAllResponseHeaders();
7960
- response = xhr.responseType ? xhr.response : xhr.responseText;
7976
+
7977
+ // responseText is the old-school way of retrieving response (supported by IE8 & 9)
7978
+ // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)
7979
+ response = ('response' in xhr) ? xhr.response : xhr.responseText;
7961
7980
  }
7962
7981
 
7963
- // responseText is the old-school way of retrieving response (supported by IE8 & 9)
7964
- // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)
7965
7982
  completeRequest(callback,
7966
7983
  status || xhr.status,
7967
7984
  response,
@@ -7994,14 +8011,14 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
7994
8011
  }
7995
8012
 
7996
8013
  function completeRequest(callback, status, response, headersString) {
7997
- var protocol = urlResolve(url).protocol;
7998
-
7999
8014
  // cancel timeout and subsequent timeout promise resolution
8000
8015
  timeoutId && $browserDefer.cancel(timeoutId);
8001
8016
  jsonpDone = xhr = null;
8002
8017
 
8003
- // fix status code for file protocol (it's always 0)
8004
- status = (protocol == 'file' && status === 0) ? (response ? 200 : 404) : status;
8018
+ // fix status code when it is 0 (0 status is undocumented).
8019
+ // Occurs when accessing file resources.
8020
+ // On Android 4.1 stock browser it occurs while retrieving files from application cache.
8021
+ status = (status === 0) ? (response ? 200 : 404) : status;
8005
8022
 
8006
8023
  // normalize IE bug (http://bugs.jquery.com/ticket/1450)
8007
8024
  status = status == 1223 ? 204 : status;
@@ -9115,7 +9132,7 @@ function $LocationProvider(){
9115
9132
  * Broadcasted before a URL will change. This change can be prevented by calling
9116
9133
  * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more
9117
9134
  * details about event object. Upon successful change
9118
- * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired.
9135
+ * {@link ng.$location#events_$locationChangeSuccess $locationChangeSuccess} is fired.
9119
9136
  *
9120
9137
  * @param {Object} angularEvent Synthetic event object.
9121
9138
  * @param {string} newUrl New URL
@@ -10306,16 +10323,20 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
10306
10323
  if (pathVal == null) return pathVal;
10307
10324
  pathVal = pathVal[key0];
10308
10325
 
10309
- if (pathVal == null) return key1 ? undefined : pathVal;
10326
+ if (!key1) return pathVal;
10327
+ if (pathVal == null) return undefined;
10310
10328
  pathVal = pathVal[key1];
10311
10329
 
10312
- if (pathVal == null) return key2 ? undefined : pathVal;
10330
+ if (!key2) return pathVal;
10331
+ if (pathVal == null) return undefined;
10313
10332
  pathVal = pathVal[key2];
10314
10333
 
10315
- if (pathVal == null) return key3 ? undefined : pathVal;
10334
+ if (!key3) return pathVal;
10335
+ if (pathVal == null) return undefined;
10316
10336
  pathVal = pathVal[key3];
10317
10337
 
10318
- if (pathVal == null) return key4 ? undefined : pathVal;
10338
+ if (!key4) return pathVal;
10339
+ if (pathVal == null) return undefined;
10319
10340
  pathVal = pathVal[key4];
10320
10341
 
10321
10342
  return pathVal;
@@ -10336,8 +10357,9 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
10336
10357
  }
10337
10358
  pathVal = pathVal.$$v;
10338
10359
  }
10339
- if (pathVal == null) return key1 ? undefined : pathVal;
10340
10360
 
10361
+ if (!key1) return pathVal;
10362
+ if (pathVal == null) return undefined;
10341
10363
  pathVal = pathVal[key1];
10342
10364
  if (pathVal && pathVal.then) {
10343
10365
  promiseWarning(fullExp);
@@ -10348,8 +10370,9 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
10348
10370
  }
10349
10371
  pathVal = pathVal.$$v;
10350
10372
  }
10351
- if (pathVal == null) return key2 ? undefined : pathVal;
10352
10373
 
10374
+ if (!key2) return pathVal;
10375
+ if (pathVal == null) return undefined;
10353
10376
  pathVal = pathVal[key2];
10354
10377
  if (pathVal && pathVal.then) {
10355
10378
  promiseWarning(fullExp);
@@ -10360,8 +10383,9 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
10360
10383
  }
10361
10384
  pathVal = pathVal.$$v;
10362
10385
  }
10363
- if (pathVal == null) return key3 ? undefined : pathVal;
10364
10386
 
10387
+ if (!key3) return pathVal;
10388
+ if (pathVal == null) return undefined;
10365
10389
  pathVal = pathVal[key3];
10366
10390
  if (pathVal && pathVal.then) {
10367
10391
  promiseWarning(fullExp);
@@ -10372,8 +10396,9 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
10372
10396
  }
10373
10397
  pathVal = pathVal.$$v;
10374
10398
  }
10375
- if (pathVal == null) return key4 ? undefined : pathVal;
10376
10399
 
10400
+ if (!key4) return pathVal;
10401
+ if (pathVal == null) return undefined;
10377
10402
  pathVal = pathVal[key4];
10378
10403
  if (pathVal && pathVal.then) {
10379
10404
  promiseWarning(fullExp);
@@ -11371,7 +11396,7 @@ function $RootScopeProvider(){
11371
11396
  } else {
11372
11397
  ChildScope = function() {}; // should be anonymous; This is so that when the minifier munges
11373
11398
  // the name it does not become random set of chars. This will then show up as class
11374
- // name in the debugger.
11399
+ // name in the web inspector.
11375
11400
  ChildScope.prototype = this;
11376
11401
  child = new ChildScope();
11377
11402
  child.$id = nextUid();
@@ -11472,7 +11497,7 @@ function $RootScopeProvider(){
11472
11497
  // No digest has been run so the counter will be zero
11473
11498
  expect(scope.foodCounter).toEqual(0);
11474
11499
 
11475
- // Run the digest but since food has not changed cout will still be zero
11500
+ // Run the digest but since food has not changed count will still be zero
11476
11501
  scope.$digest();
11477
11502
  expect(scope.foodCounter).toEqual(0);
11478
11503
 
@@ -11817,7 +11842,7 @@ function $RootScopeProvider(){
11817
11842
 
11818
11843
  // `break traverseScopesLoop;` takes us to here
11819
11844
 
11820
- if(dirty && !(ttl--)) {
11845
+ if((dirty || asyncQueue.length) && !(ttl--)) {
11821
11846
  clearPhase();
11822
11847
  throw $rootScopeMinErr('infdig',
11823
11848
  '{0} $digest() iterations reached. Aborting!\n' +
@@ -12668,7 +12693,7 @@ function $SceDelegateProvider() {
12668
12693
  *
12669
12694
  * @param {*} value The result of a prior {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`}
12670
12695
  * call or anything else.
12671
- * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#methods_trustAs
12696
+ * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#methods_trustAs
12672
12697
  * `$sceDelegate.trustAs`} if `value` is the result of such a call. Otherwise, returns
12673
12698
  * `value` unchanged.
12674
12699
  */
@@ -13895,8 +13920,8 @@ function $FilterProvider($provide) {
13895
13920
  *
13896
13921
  * Can be one of:
13897
13922
  *
13898
- * - `string`: Predicate that results in a substring match using the value of `expression`
13899
- * string. All strings or objects with string properties in `array` that contain this string
13923
+ * - `string`: The string is evaluated as an expression and the resulting value is used for substring match against
13924
+ * the contents of the `array`. All strings or objects with string properties in `array` that contain this string
13900
13925
  * will be returned. The predicate can be negated by prefixing the string with `!`.
13901
13926
  *
13902
13927
  * - `Object`: A pattern object can be used to filter specific properties on objects contained
@@ -14054,23 +14079,12 @@ function filterFilter() {
14054
14079
  case "object":
14055
14080
  // jshint +W086
14056
14081
  for (var key in expression) {
14057
- if (key == '$') {
14058
- (function() {
14059
- if (!expression[key]) return;
14060
- var path = key;
14061
- predicates.push(function(value) {
14062
- return search(value, expression[path]);
14063
- });
14064
- })();
14065
- } else {
14066
- (function() {
14067
- if (typeof(expression[key]) == 'undefined') { return; }
14068
- var path = key;
14069
- predicates.push(function(value) {
14070
- return search(getter(value,path), expression[path]);
14071
- });
14072
- })();
14073
- }
14082
+ (function(path) {
14083
+ if (typeof expression[path] == 'undefined') return;
14084
+ predicates.push(function(value) {
14085
+ return search(path == '$' ? value : getter(value, path), expression[path]);
14086
+ });
14087
+ })(key);
14074
14088
  }
14075
14089
  break;
14076
14090
  case 'function':
@@ -15191,12 +15205,10 @@ forEach(BOOLEAN_ATTR, function(propName, attrName) {
15191
15205
  ngAttributeAliasDirectives[normalized] = function() {
15192
15206
  return {
15193
15207
  priority: 100,
15194
- compile: function() {
15195
- return function(scope, element, attr) {
15196
- scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {
15197
- attr.$set(attrName, !!value);
15198
- });
15199
- };
15208
+ link: function(scope, element, attr) {
15209
+ scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {
15210
+ attr.$set(attrName, !!value);
15211
+ });
15200
15212
  }
15201
15213
  };
15202
15214
  };
@@ -15476,10 +15488,10 @@ function FormController(element, attrs) {
15476
15488
  *
15477
15489
  *
15478
15490
  * # CSS classes
15479
- * - `ng-valid` Is set if the form is valid.
15480
- * - `ng-invalid` Is set if the form is invalid.
15481
- * - `ng-pristine` Is set if the form is pristine.
15482
- * - `ng-dirty` Is set if the form is dirty.
15491
+ * - `ng-valid` is set if the form is valid.
15492
+ * - `ng-invalid` is set if the form is invalid.
15493
+ * - `ng-pristine` is set if the form is pristine.
15494
+ * - `ng-dirty` is set if the form is dirty.
15483
15495
  *
15484
15496
  *
15485
15497
  * # Submitting a form and preventing the default action
@@ -15996,6 +16008,12 @@ var inputType = {
15996
16008
  'reset': noop
15997
16009
  };
15998
16010
 
16011
+ // A helper function to call $setValidity and return the value / undefined,
16012
+ // a pattern that is repeated a lot in the input validation logic.
16013
+ function validate(ctrl, validatorName, validity, value){
16014
+ ctrl.$setValidity(validatorName, validity);
16015
+ return validity ? value : undefined;
16016
+ }
15999
16017
 
16000
16018
  function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
16001
16019
  // In composition mode, users are still inputing intermediate text buffer,
@@ -16080,22 +16098,15 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
16080
16098
  patternValidator,
16081
16099
  match;
16082
16100
 
16083
- var validate = function(regexp, value) {
16084
- if (ctrl.$isEmpty(value) || regexp.test(value)) {
16085
- ctrl.$setValidity('pattern', true);
16086
- return value;
16087
- } else {
16088
- ctrl.$setValidity('pattern', false);
16089
- return undefined;
16090
- }
16091
- };
16092
-
16093
16101
  if (pattern) {
16102
+ var validateRegex = function(regexp, value) {
16103
+ return validate(ctrl, 'pattern', ctrl.$isEmpty(value) || regexp.test(value), value);
16104
+ };
16094
16105
  match = pattern.match(/^\/(.*)\/([gim]*)$/);
16095
16106
  if (match) {
16096
16107
  pattern = new RegExp(match[1], match[2]);
16097
16108
  patternValidator = function(value) {
16098
- return validate(pattern, value);
16109
+ return validateRegex(pattern, value);
16099
16110
  };
16100
16111
  } else {
16101
16112
  patternValidator = function(value) {
@@ -16106,7 +16117,7 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
16106
16117
  'Expected {0} to be a RegExp but was {1}. Element: {2}', pattern,
16107
16118
  patternObj, startingTag(element));
16108
16119
  }
16109
- return validate(patternObj, value);
16120
+ return validateRegex(patternObj, value);
16110
16121
  };
16111
16122
  }
16112
16123
 
@@ -16118,13 +16129,7 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
16118
16129
  if (attr.ngMinlength) {
16119
16130
  var minlength = int(attr.ngMinlength);
16120
16131
  var minLengthValidator = function(value) {
16121
- if (!ctrl.$isEmpty(value) && value.length < minlength) {
16122
- ctrl.$setValidity('minlength', false);
16123
- return undefined;
16124
- } else {
16125
- ctrl.$setValidity('minlength', true);
16126
- return value;
16127
- }
16132
+ return validate(ctrl, 'minlength', ctrl.$isEmpty(value) || value.length >= minlength, value);
16128
16133
  };
16129
16134
 
16130
16135
  ctrl.$parsers.push(minLengthValidator);
@@ -16135,13 +16140,7 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
16135
16140
  if (attr.ngMaxlength) {
16136
16141
  var maxlength = int(attr.ngMaxlength);
16137
16142
  var maxLengthValidator = function(value) {
16138
- if (!ctrl.$isEmpty(value) && value.length > maxlength) {
16139
- ctrl.$setValidity('maxlength', false);
16140
- return undefined;
16141
- } else {
16142
- ctrl.$setValidity('maxlength', true);
16143
- return value;
16144
- }
16143
+ return validate(ctrl, 'maxlength', ctrl.$isEmpty(value) || value.length <= maxlength, value);
16145
16144
  };
16146
16145
 
16147
16146
  ctrl.$parsers.push(maxLengthValidator);
@@ -16170,13 +16169,7 @@ function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
16170
16169
  if (attr.min) {
16171
16170
  var minValidator = function(value) {
16172
16171
  var min = parseFloat(attr.min);
16173
- if (!ctrl.$isEmpty(value) && value < min) {
16174
- ctrl.$setValidity('min', false);
16175
- return undefined;
16176
- } else {
16177
- ctrl.$setValidity('min', true);
16178
- return value;
16179
- }
16172
+ return validate(ctrl, 'min', ctrl.$isEmpty(value) || value >= min, value);
16180
16173
  };
16181
16174
 
16182
16175
  ctrl.$parsers.push(minValidator);
@@ -16186,13 +16179,7 @@ function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
16186
16179
  if (attr.max) {
16187
16180
  var maxValidator = function(value) {
16188
16181
  var max = parseFloat(attr.max);
16189
- if (!ctrl.$isEmpty(value) && value > max) {
16190
- ctrl.$setValidity('max', false);
16191
- return undefined;
16192
- } else {
16193
- ctrl.$setValidity('max', true);
16194
- return value;
16195
- }
16182
+ return validate(ctrl, 'max', ctrl.$isEmpty(value) || value <= max, value);
16196
16183
  };
16197
16184
 
16198
16185
  ctrl.$parsers.push(maxValidator);
@@ -16200,14 +16187,7 @@ function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
16200
16187
  }
16201
16188
 
16202
16189
  ctrl.$formatters.push(function(value) {
16203
-
16204
- if (ctrl.$isEmpty(value) || isNumber(value)) {
16205
- ctrl.$setValidity('number', true);
16206
- return value;
16207
- } else {
16208
- ctrl.$setValidity('number', false);
16209
- return undefined;
16210
- }
16190
+ return validate(ctrl, 'number', ctrl.$isEmpty(value) || isNumber(value), value);
16211
16191
  });
16212
16192
  }
16213
16193
 
@@ -16215,13 +16195,7 @@ function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
16215
16195
  textInputType(scope, element, attr, ctrl, $sniffer, $browser);
16216
16196
 
16217
16197
  var urlValidator = function(value) {
16218
- if (ctrl.$isEmpty(value) || URL_REGEXP.test(value)) {
16219
- ctrl.$setValidity('url', true);
16220
- return value;
16221
- } else {
16222
- ctrl.$setValidity('url', false);
16223
- return undefined;
16224
- }
16198
+ return validate(ctrl, 'url', ctrl.$isEmpty(value) || URL_REGEXP.test(value), value);
16225
16199
  };
16226
16200
 
16227
16201
  ctrl.$formatters.push(urlValidator);
@@ -16232,13 +16206,7 @@ function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
16232
16206
  textInputType(scope, element, attr, ctrl, $sniffer, $browser);
16233
16207
 
16234
16208
  var emailValidator = function(value) {
16235
- if (ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value)) {
16236
- ctrl.$setValidity('email', true);
16237
- return value;
16238
- } else {
16239
- ctrl.$setValidity('email', false);
16240
- return undefined;
16241
- }
16209
+ return validate(ctrl, 'email', ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value), value);
16242
16210
  };
16243
16211
 
16244
16212
  ctrl.$formatters.push(emailValidator);
@@ -17842,13 +17810,13 @@ var ngControllerDirective = [function() {
17842
17810
  </button>
17843
17811
  count: {{count}}
17844
17812
  </doc:source>
17845
- <doc:scenario>
17813
+ <doc:protractor>
17846
17814
  it('should check ng-click', function() {
17847
- expect(binding('count')).toBe('0');
17848
- element('.doc-example-live :button').click();
17849
- expect(binding('count')).toBe('1');
17815
+ expect(element(by.binding('count')).getText()).toMatch('0');
17816
+ element(by.css('.doc-example-live button')).click();
17817
+ expect(element(by.binding('count')).getText()).toMatch('1');
17850
17818
  });
17851
- </doc:scenario>
17819
+ </doc:protractor>
17852
17820
  </doc:example>
17853
17821
  */
17854
17822
  /*
@@ -18927,6 +18895,8 @@ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp
18927
18895
  * | `$even` | {@type boolean} | true if the iterator position `$index` is even (otherwise false). |
18928
18896
  * | `$odd` | {@type boolean} | true if the iterator position `$index` is odd (otherwise false). |
18929
18897
  *
18898
+ * Creating aliases for these properties is possible with {@link api/ng.directive:ngInit `ngInit`}.
18899
+ * This may be useful when, for instance, nesting ngRepeats.
18930
18900
  *
18931
18901
  * # Special repeat start and end points
18932
18902
  * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending
@@ -19809,11 +19779,9 @@ var ngSwitchWhenDirective = ngDirective({
19809
19779
  transclude: 'element',
19810
19780
  priority: 800,
19811
19781
  require: '^ngSwitch',
19812
- compile: function(element, attrs) {
19813
- return function(scope, element, attr, ctrl, $transclude) {
19814
- ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);
19815
- ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });
19816
- };
19782
+ link: function(scope, element, attrs, ctrl, $transclude) {
19783
+ ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);
19784
+ ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });
19817
19785
  }
19818
19786
  });
19819
19787
 
@@ -19908,10 +19876,14 @@ var ngTranscludeDirective = ngDirective({
19908
19876
  * @restrict E
19909
19877
  *
19910
19878
  * @description
19911
- * Load content of a script tag, with type `text/ng-template`, into `$templateCache`, so that the
19912
- * template can be used by `ngInclude`, `ngView` or directive templates.
19879
+ * Load the content of a `<script>` element into {@link api/ng.$templateCache `$templateCache`}, so that the
19880
+ * template can be used by {@link api/ng.directive:ngInclude `ngInclude`},
19881
+ * {@link api/ngRoute.directive:ngView `ngView`}, or {@link guide/directive directives}. The type of the
19882
+ * `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be
19883
+ * assigned through the element's `id`, which can then be used as a directive's `templateUrl`.
19913
19884
  *
19914
- * @param {'text/ng-template'} type must be set to `'text/ng-template'`
19885
+ * @param {'text/ng-template'} type Must be set to `'text/ng-template'`.
19886
+ * @param {string} id Cache name of the template.
19915
19887
  *
19916
19888
  * @example
19917
19889
  <doc:example>
@@ -20075,8 +20047,8 @@ var ngOptionsMinErr = minErr('ngOptions');
20075
20047
  var ngOptionsDirective = valueFn({ terminal: true });
20076
20048
  // jshint maxlen: false
20077
20049
  var selectDirective = ['$compile', '$parse', function($compile, $parse) {
20078
- //0000111110000000000022220000000000000000000000333300000000000000444444444444444000000000555555555555555000000066666666666666600000000000000007777000000000000000000088888
20079
- var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/,
20050
+ //000011111111110000000000022222222220000000000000000000003333333333000000000000004444444444444440000000005555555555555550000000666666666666666000000000000000777777777700000000000000000008888888888
20051
+ var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,
20080
20052
  nullModelCtrl = {$setViewValue: noop};
20081
20053
  // jshint maxlen: 100
20082
20054