rails-angularjs 1.4.0 → 1.4.1

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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/rails-angularjs/version.rb +1 -1
  4. data/vendor/assets/javascripts/angular-animate.js +4 -3
  5. data/vendor/assets/javascripts/angular-animate.min.js +1 -1
  6. data/vendor/assets/javascripts/angular-animate.min.js.map +1 -1
  7. data/vendor/assets/javascripts/angular-aria.js +20 -11
  8. data/vendor/assets/javascripts/angular-aria.min.js +8 -8
  9. data/vendor/assets/javascripts/angular-aria.min.js.map +2 -2
  10. data/vendor/assets/javascripts/angular-cookies.js +2 -2
  11. data/vendor/assets/javascripts/angular-cookies.min.js +1 -1
  12. data/vendor/assets/javascripts/angular-loader.js +23 -10
  13. data/vendor/assets/javascripts/angular-loader.min.js +4 -4
  14. data/vendor/assets/javascripts/angular-loader.min.js.map +2 -2
  15. data/vendor/assets/javascripts/angular-message-format.js +1 -1
  16. data/vendor/assets/javascripts/angular-message-format.min.js +1 -1
  17. data/vendor/assets/javascripts/angular-messages.js +3 -3
  18. data/vendor/assets/javascripts/angular-messages.min.js +1 -1
  19. data/vendor/assets/javascripts/angular-mocks.js +2 -2
  20. data/vendor/assets/javascripts/angular-resource.js +1 -1
  21. data/vendor/assets/javascripts/angular-resource.min.js +1 -1
  22. data/vendor/assets/javascripts/angular-route.js +1 -1
  23. data/vendor/assets/javascripts/angular-route.min.js +1 -1
  24. data/vendor/assets/javascripts/angular-sanitize.js +4 -4
  25. data/vendor/assets/javascripts/angular-sanitize.min.js +4 -4
  26. data/vendor/assets/javascripts/angular-sanitize.min.js.map +1 -1
  27. data/vendor/assets/javascripts/angular-scenario.js +271 -110
  28. data/vendor/assets/javascripts/angular-touch.js +1 -1
  29. data/vendor/assets/javascripts/angular-touch.min.js +1 -1
  30. data/vendor/assets/javascripts/angular.js +271 -110
  31. data/vendor/assets/javascripts/angular.min.js +284 -283
  32. data/vendor/assets/javascripts/angular.min.js.map +3 -3
  33. metadata +2 -2
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.4.0
2
+ * @license AngularJS v1.4.1
3
3
  * (c) 2010-2015 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*
2
- AngularJS v1.4.0
2
+ AngularJS v1.4.1
3
3
  (c) 2010-2015 Google, Inc. http://angularjs.org
4
4
  License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.4.0
2
+ * @license AngularJS v1.4.1
3
3
  * (c) 2010-2015 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -57,7 +57,7 @@ function minErr(module, ErrorConstructor) {
57
57
  return match;
58
58
  });
59
59
 
60
- message += '\nhttp://errors.angularjs.org/1.4.0/' +
60
+ message += '\nhttp://errors.angularjs.org/1.4.1/' +
61
61
  (module ? module + '/' : '') + code;
62
62
 
63
63
  for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
@@ -864,9 +864,18 @@ function copy(source, destination, stackSource, stackDest) {
864
864
 
865
865
  if (!destination) {
866
866
  destination = source;
867
- if (source) {
867
+ if (isObject(source)) {
868
+ var index;
869
+ if (stackSource && (index = stackSource.indexOf(source)) !== -1) {
870
+ return stackDest[index];
871
+ }
872
+
873
+ // TypedArray, Date and RegExp have specific copy functionality and must be
874
+ // pushed onto the stack before returning.
875
+ // Array and other objects create the base object and recurse to copy child
876
+ // objects. The array/object will be pushed onto the stack when recursed.
868
877
  if (isArray(source)) {
869
- destination = copy(source, [], stackSource, stackDest);
878
+ return copy(source, [], stackSource, stackDest);
870
879
  } else if (isTypedArray(source)) {
871
880
  destination = new source.constructor(source);
872
881
  } else if (isDate(source)) {
@@ -874,9 +883,14 @@ function copy(source, destination, stackSource, stackDest) {
874
883
  } else if (isRegExp(source)) {
875
884
  destination = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
876
885
  destination.lastIndex = source.lastIndex;
877
- } else if (isObject(source)) {
886
+ } else {
878
887
  var emptyObject = Object.create(getPrototypeOf(source));
879
- destination = copy(source, emptyObject, stackSource, stackDest);
888
+ return copy(source, emptyObject, stackSource, stackDest);
889
+ }
890
+
891
+ if (stackDest) {
892
+ stackSource.push(source);
893
+ stackDest.push(destination);
880
894
  }
881
895
  }
882
896
  } else {
@@ -887,9 +901,6 @@ function copy(source, destination, stackSource, stackDest) {
887
901
  stackDest = stackDest || [];
888
902
 
889
903
  if (isObject(source)) {
890
- var index = stackSource.indexOf(source);
891
- if (index !== -1) return stackDest[index];
892
-
893
904
  stackSource.push(source);
894
905
  stackDest.push(destination);
895
906
  }
@@ -898,12 +909,7 @@ function copy(source, destination, stackSource, stackDest) {
898
909
  if (isArray(source)) {
899
910
  destination.length = 0;
900
911
  for (var i = 0; i < source.length; i++) {
901
- result = copy(source[i], null, stackSource, stackDest);
902
- if (isObject(source[i])) {
903
- stackSource.push(source[i]);
904
- stackDest.push(result);
905
- }
906
- destination.push(result);
912
+ destination.push(copy(source[i], null, stackSource, stackDest));
907
913
  }
908
914
  } else {
909
915
  var h = destination.$$hashKey;
@@ -917,20 +923,20 @@ function copy(source, destination, stackSource, stackDest) {
917
923
  if (isBlankObject(source)) {
918
924
  // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
919
925
  for (key in source) {
920
- putValue(key, source[key], destination, stackSource, stackDest);
926
+ destination[key] = copy(source[key], null, stackSource, stackDest);
921
927
  }
922
928
  } else if (source && typeof source.hasOwnProperty === 'function') {
923
929
  // Slow path, which must rely on hasOwnProperty
924
930
  for (key in source) {
925
931
  if (source.hasOwnProperty(key)) {
926
- putValue(key, source[key], destination, stackSource, stackDest);
932
+ destination[key] = copy(source[key], null, stackSource, stackDest);
927
933
  }
928
934
  }
929
935
  } else {
930
936
  // Slowest path --- hasOwnProperty can't be called as a method
931
937
  for (key in source) {
932
938
  if (hasOwnProperty.call(source, key)) {
933
- putValue(key, source[key], destination, stackSource, stackDest);
939
+ destination[key] = copy(source[key], null, stackSource, stackDest);
934
940
  }
935
941
  }
936
942
  }
@@ -938,16 +944,6 @@ function copy(source, destination, stackSource, stackDest) {
938
944
  }
939
945
  }
940
946
  return destination;
941
-
942
- function putValue(key, val, destination, stackSource, stackDest) {
943
- // No context allocation, trivial outer scope, easily inlined
944
- var result = copy(val, null, stackSource, stackDest);
945
- if (isObject(val)) {
946
- stackSource.push(val);
947
- stackDest.push(result);
948
- }
949
- destination[key] = result;
950
- }
951
947
  }
952
948
 
953
949
  /**
@@ -2005,7 +2001,7 @@ function setupModuleLoader(window) {
2005
2001
  * @description
2006
2002
  * See {@link auto.$provide#provider $provide.provider()}.
2007
2003
  */
2008
- provider: invokeLater('$provide', 'provider'),
2004
+ provider: invokeLaterAndSetModuleName('$provide', 'provider'),
2009
2005
 
2010
2006
  /**
2011
2007
  * @ngdoc method
@@ -2016,7 +2012,7 @@ function setupModuleLoader(window) {
2016
2012
  * @description
2017
2013
  * See {@link auto.$provide#factory $provide.factory()}.
2018
2014
  */
2019
- factory: invokeLater('$provide', 'factory'),
2015
+ factory: invokeLaterAndSetModuleName('$provide', 'factory'),
2020
2016
 
2021
2017
  /**
2022
2018
  * @ngdoc method
@@ -2027,7 +2023,7 @@ function setupModuleLoader(window) {
2027
2023
  * @description
2028
2024
  * See {@link auto.$provide#service $provide.service()}.
2029
2025
  */
2030
- service: invokeLater('$provide', 'service'),
2026
+ service: invokeLaterAndSetModuleName('$provide', 'service'),
2031
2027
 
2032
2028
  /**
2033
2029
  * @ngdoc method
@@ -2062,7 +2058,7 @@ function setupModuleLoader(window) {
2062
2058
  * @description
2063
2059
  * See {@link auto.$provide#decorator $provide.decorator()}.
2064
2060
  */
2065
- decorator: invokeLater('$provide', 'decorator'),
2061
+ decorator: invokeLaterAndSetModuleName('$provide', 'decorator'),
2066
2062
 
2067
2063
  /**
2068
2064
  * @ngdoc method
@@ -2096,7 +2092,7 @@ function setupModuleLoader(window) {
2096
2092
  * See {@link ng.$animateProvider#register $animateProvider.register()} and
2097
2093
  * {@link ngAnimate ngAnimate module} for more information.
2098
2094
  */
2099
- animation: invokeLater('$animateProvider', 'register'),
2095
+ animation: invokeLaterAndSetModuleName('$animateProvider', 'register'),
2100
2096
 
2101
2097
  /**
2102
2098
  * @ngdoc method
@@ -2114,7 +2110,7 @@ function setupModuleLoader(window) {
2114
2110
  * (`myapp_subsection_filterx`).
2115
2111
  * </div>
2116
2112
  */
2117
- filter: invokeLater('$filterProvider', 'register'),
2113
+ filter: invokeLaterAndSetModuleName('$filterProvider', 'register'),
2118
2114
 
2119
2115
  /**
2120
2116
  * @ngdoc method
@@ -2126,7 +2122,7 @@ function setupModuleLoader(window) {
2126
2122
  * @description
2127
2123
  * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
2128
2124
  */
2129
- controller: invokeLater('$controllerProvider', 'register'),
2125
+ controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'),
2130
2126
 
2131
2127
  /**
2132
2128
  * @ngdoc method
@@ -2139,7 +2135,7 @@ function setupModuleLoader(window) {
2139
2135
  * @description
2140
2136
  * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
2141
2137
  */
2142
- directive: invokeLater('$compileProvider', 'directive'),
2138
+ directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'),
2143
2139
 
2144
2140
  /**
2145
2141
  * @ngdoc method
@@ -2189,6 +2185,19 @@ function setupModuleLoader(window) {
2189
2185
  return moduleInstance;
2190
2186
  };
2191
2187
  }
2188
+
2189
+ /**
2190
+ * @param {string} provider
2191
+ * @param {string} method
2192
+ * @returns {angular.Module}
2193
+ */
2194
+ function invokeLaterAndSetModuleName(provider, method) {
2195
+ return function(recipeName, factoryFunction) {
2196
+ if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;
2197
+ invokeQueue.push([provider, method, arguments]);
2198
+ return moduleInstance;
2199
+ };
2200
+ }
2192
2201
  });
2193
2202
  };
2194
2203
  });
@@ -2332,11 +2341,11 @@ function toDebugString(obj) {
2332
2341
  * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
2333
2342
  */
2334
2343
  var version = {
2335
- full: '1.4.0', // all of these placeholder strings will be replaced by grunt's
2344
+ full: '1.4.1', // all of these placeholder strings will be replaced by grunt's
2336
2345
  major: 1, // package task
2337
2346
  minor: 4,
2338
- dot: 0,
2339
- codeName: 'jaracimrman-existence'
2347
+ dot: 1,
2348
+ codeName: 'hyperionic-illumination'
2340
2349
  };
2341
2350
 
2342
2351
 
@@ -2662,6 +2671,13 @@ function jqLiteAcceptsData(node) {
2662
2671
  return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT;
2663
2672
  }
2664
2673
 
2674
+ function jqLiteHasData(node) {
2675
+ for (var key in jqCache[node.ng339]) {
2676
+ return true;
2677
+ }
2678
+ return false;
2679
+ }
2680
+
2665
2681
  function jqLiteBuildFragment(html, context) {
2666
2682
  var tmp, tag, wrap,
2667
2683
  fragment = context.createDocumentFragment(),
@@ -3036,7 +3052,8 @@ function getAliasedAttrName(element, name) {
3036
3052
 
3037
3053
  forEach({
3038
3054
  data: jqLiteData,
3039
- removeData: jqLiteRemoveData
3055
+ removeData: jqLiteRemoveData,
3056
+ hasData: jqLiteHasData
3040
3057
  }, function(fn, name) {
3041
3058
  JQLite[name] = fn;
3042
3059
  });
@@ -4245,7 +4262,7 @@ function createInjector(modulesToLoad, strictDi) {
4245
4262
  }));
4246
4263
 
4247
4264
 
4248
- forEach(loadModules(modulesToLoad), function(fn) { instanceInjector.invoke(fn || noop); });
4265
+ forEach(loadModules(modulesToLoad), function(fn) { if (fn) instanceInjector.invoke(fn); });
4249
4266
 
4250
4267
  return instanceInjector;
4251
4268
 
@@ -5468,7 +5485,7 @@ function Browser(window, document, $log, $sniffer) {
5468
5485
  // Do the assignment again so that those two variables are referentially identical.
5469
5486
  lastHistoryState = cachedState;
5470
5487
  } else {
5471
- if (!sameBase) {
5488
+ if (!sameBase || reloadLocation) {
5472
5489
  reloadLocation = url;
5473
5490
  }
5474
5491
  if (replace) {
@@ -6474,13 +6491,16 @@ function $TemplateCacheProvider() {
6474
6491
  * * `controller` - the directive's required controller instance(s) - Instances are shared
6475
6492
  * among all directives, which allows the directives to use the controllers as a communication
6476
6493
  * channel. The exact value depends on the directive's `require` property:
6494
+ * * no controller(s) required: the directive's own controller, or `undefined` if it doesn't have one
6477
6495
  * * `string`: the controller instance
6478
6496
  * * `array`: array of controller instances
6479
- * * no controller(s) required: `undefined`
6480
6497
  *
6481
6498
  * If a required controller cannot be found, and it is optional, the instance is `null`,
6482
6499
  * otherwise the {@link error:$compile:ctreq Missing Required Controller} error is thrown.
6483
6500
  *
6501
+ * Note that you can also require the directive's own controller - it will be made available like
6502
+ * like any other controller.
6503
+ *
6484
6504
  * * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.
6485
6505
  * This is the same as the `$transclude`
6486
6506
  * parameter of directive controllers, see there for details.
@@ -6927,6 +6947,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
6927
6947
  if (isObject(bindings.isolateScope)) {
6928
6948
  directive.$$isolateBindings = bindings.isolateScope;
6929
6949
  }
6950
+ directive.$$moduleName = directiveFactory.$$moduleName;
6930
6951
  directives.push(directive);
6931
6952
  } catch (e) {
6932
6953
  $exceptionHandler(e);
@@ -7498,8 +7519,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
7498
7519
 
7499
7520
  if (nodeLinkFn.transcludeOnThisElement) {
7500
7521
  childBoundTranscludeFn = createBoundTranscludeFn(
7501
- scope, nodeLinkFn.transclude, parentBoundTranscludeFn,
7502
- nodeLinkFn.elementTranscludeOnThisElement);
7522
+ scope, nodeLinkFn.transclude, parentBoundTranscludeFn);
7503
7523
 
7504
7524
  } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {
7505
7525
  childBoundTranscludeFn = parentBoundTranscludeFn;
@@ -7521,7 +7541,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
7521
7541
  }
7522
7542
  }
7523
7543
 
7524
- function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn, elementTransclusion) {
7544
+ function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {
7525
7545
 
7526
7546
  var boundTranscludeFn = function(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) {
7527
7547
 
@@ -7620,6 +7640,13 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
7620
7640
  }
7621
7641
  break;
7622
7642
  case NODE_TYPE_TEXT: /* Text Node */
7643
+ if (msie === 11) {
7644
+ // Workaround for #11781
7645
+ while (node.parentNode && node.nextSibling && node.nextSibling.nodeType === NODE_TYPE_TEXT) {
7646
+ node.nodeValue = node.nodeValue + node.nextSibling.nodeValue;
7647
+ node.parentNode.removeChild(node.nextSibling);
7648
+ }
7649
+ }
7623
7650
  addTextInterpolateDirective(directives, node.nodeValue);
7624
7651
  break;
7625
7652
  case NODE_TYPE_COMMENT: /* Comment */
@@ -7912,7 +7939,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
7912
7939
 
7913
7940
  nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;
7914
7941
  nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective;
7915
- nodeLinkFn.elementTranscludeOnThisElement = hasElementTranscludeDirective;
7916
7942
  nodeLinkFn.templateOnThisElement = hasTemplate;
7917
7943
  nodeLinkFn.transclude = childTranscludeFn;
7918
7944
 
@@ -8073,9 +8099,12 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
8073
8099
  for (i in elementControllers) {
8074
8100
  controller = elementControllers[i];
8075
8101
  var controllerResult = controller();
8102
+
8076
8103
  if (controllerResult !== controller.instance) {
8104
+ // If the controller constructor has a return value, overwrite the instance
8105
+ // from setupControllers and update the element data
8077
8106
  controller.instance = controllerResult;
8078
- $element.data('$' + directive.name + 'Controller', controllerResult);
8107
+ $element.data('$' + i + 'Controller', controllerResult);
8079
8108
  if (controller === controllerForBindings) {
8080
8109
  // Remove and re-install bindToController bindings
8081
8110
  thisLinkFn.$$destroyBindings();
@@ -8375,11 +8404,18 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
8375
8404
  return a.index - b.index;
8376
8405
  }
8377
8406
 
8378
-
8379
8407
  function assertNoDuplicate(what, previousDirective, directive, element) {
8408
+
8409
+ function wrapModuleNameIfDefined(moduleName) {
8410
+ return moduleName ?
8411
+ (' (module: ' + moduleName + ')') :
8412
+ '';
8413
+ }
8414
+
8380
8415
  if (previousDirective) {
8381
- throw $compileMinErr('multidir', 'Multiple directives [{0}, {1}] asking for {2} on: {3}',
8382
- previousDirective.name, directive.name, what, startingTag(element));
8416
+ throw $compileMinErr('multidir', 'Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}',
8417
+ previousDirective.name, wrapModuleNameIfDefined(previousDirective.$$moduleName),
8418
+ directive.name, wrapModuleNameIfDefined(directive.$$moduleName), what, startingTag(element));
8383
8419
  }
8384
8420
  }
8385
8421
 
@@ -8560,26 +8596,28 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
8560
8596
  var fragment = document.createDocumentFragment();
8561
8597
  fragment.appendChild(firstElementToRemove);
8562
8598
 
8563
- // Copy over user data (that includes Angular's $scope etc.). Don't copy private
8564
- // data here because there's no public interface in jQuery to do that and copying over
8565
- // event listeners (which is the main use of private data) wouldn't work anyway.
8566
- jqLite(newNode).data(jqLite(firstElementToRemove).data());
8567
-
8568
- // Remove data of the replaced element. We cannot just call .remove()
8569
- // on the element it since that would deallocate scope that is needed
8570
- // for the new node. Instead, remove the data "manually".
8571
- if (!jQuery) {
8572
- delete jqLite.cache[firstElementToRemove[jqLite.expando]];
8573
- } else {
8574
- // jQuery 2.x doesn't expose the data storage. Use jQuery.cleanData to clean up after
8575
- // the replaced element. The cleanData version monkey-patched by Angular would cause
8576
- // the scope to be trashed and we do need the very same scope to work with the new
8577
- // element. However, we cannot just cache the non-patched version and use it here as
8578
- // that would break if another library patches the method after Angular does (one
8579
- // example is jQuery UI). Instead, set a flag indicating scope destroying should be
8580
- // skipped this one time.
8581
- skipDestroyOnNextJQueryCleanData = true;
8582
- jQuery.cleanData([firstElementToRemove]);
8599
+ if (jqLite.hasData(firstElementToRemove)) {
8600
+ // Copy over user data (that includes Angular's $scope etc.). Don't copy private
8601
+ // data here because there's no public interface in jQuery to do that and copying over
8602
+ // event listeners (which is the main use of private data) wouldn't work anyway.
8603
+ jqLite(newNode).data(jqLite(firstElementToRemove).data());
8604
+
8605
+ // Remove data of the replaced element. We cannot just call .remove()
8606
+ // on the element it since that would deallocate scope that is needed
8607
+ // for the new node. Instead, remove the data "manually".
8608
+ if (!jQuery) {
8609
+ delete jqLite.cache[firstElementToRemove[jqLite.expando]];
8610
+ } else {
8611
+ // jQuery 2.x doesn't expose the data storage. Use jQuery.cleanData to clean up after
8612
+ // the replaced element. The cleanData version monkey-patched by Angular would cause
8613
+ // the scope to be trashed and we do need the very same scope to work with the new
8614
+ // element. However, we cannot just cache the non-patched version and use it here as
8615
+ // that would break if another library patches the method after Angular does (one
8616
+ // example is jQuery UI). Instead, set a flag indicating scope destroying should be
8617
+ // skipped this one time.
8618
+ skipDestroyOnNextJQueryCleanData = true;
8619
+ jQuery.cleanData([firstElementToRemove]);
8620
+ }
8583
8621
  }
8584
8622
 
8585
8623
  for (var k = 1, kk = elementsToRemove.length; k < kk; k++) {
@@ -8620,9 +8658,19 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
8620
8658
  lastValue,
8621
8659
  parentGet, parentSet, compare;
8622
8660
 
8661
+ if (!hasOwnProperty.call(attrs, attrName)) {
8662
+ // In the case of user defined a binding with the same name as a method in Object.prototype but didn't set
8663
+ // the corresponding attribute. We need to make sure subsequent code won't access to the prototype function
8664
+ attrs[attrName] = undefined;
8665
+ }
8666
+
8623
8667
  switch (mode) {
8624
8668
 
8625
8669
  case '@':
8670
+ if (!attrs[attrName] && !optional) {
8671
+ destination[scopeName] = undefined;
8672
+ }
8673
+
8626
8674
  attrs.$observe(attrName, function(value) {
8627
8675
  destination[scopeName] = value;
8628
8676
  });
@@ -8639,6 +8687,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
8639
8687
  return;
8640
8688
  }
8641
8689
  parentGet = $parse(attrs[attrName]);
8690
+
8642
8691
  if (parentGet.literal) {
8643
8692
  compare = equals;
8644
8693
  } else {
@@ -8677,9 +8726,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
8677
8726
  break;
8678
8727
 
8679
8728
  case '&':
8680
- // Don't assign Object.prototype method to scope
8681
- if (!attrs.hasOwnProperty(attrName) && optional) break;
8682
-
8683
8729
  parentGet = $parse(attrs[attrName]);
8684
8730
 
8685
8731
  // Don't assign noop to destination if expression is not valid
@@ -9080,13 +9126,17 @@ function $HttpParamSerializerProvider() {
9080
9126
  * @name $httpParamSerializer
9081
9127
  * @description
9082
9128
  *
9083
- * Default $http params serializer that converts objects to a part of a request URL
9129
+ * Default {@link $http `$http`} params serializer that converts objects to strings
9084
9130
  * according to the following rules:
9131
+ *
9085
9132
  * * `{'foo': 'bar'}` results in `foo=bar`
9086
9133
  * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object)
9087
9134
  * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element)
9088
9135
  * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D"` (stringified and encoded representation of an object)
9136
+ *
9137
+ * Note that serializer will sort the request parameters alphabetically.
9089
9138
  * */
9139
+
9090
9140
  this.$get = function() {
9091
9141
  return function ngParamSerializer(params) {
9092
9142
  if (!params) return '';
@@ -9113,7 +9163,43 @@ function $HttpParamSerializerJQLikeProvider() {
9113
9163
  * @name $httpParamSerializerJQLike
9114
9164
  * @description
9115
9165
  *
9116
- * Alternative $http params serializer that follows jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic.
9166
+ * Alternative {@link $http `$http`} params serializer that follows
9167
+ * jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic.
9168
+ * The serializer will also sort the params alphabetically.
9169
+ *
9170
+ * To use it for serializing `$http` request parameters, set it as the `paramSerializer` property:
9171
+ *
9172
+ * ```js
9173
+ * $http({
9174
+ * url: myUrl,
9175
+ * method: 'GET',
9176
+ * params: myParams,
9177
+ * paramSerializer: '$httpParamSerializerJQLike'
9178
+ * });
9179
+ * ```
9180
+ *
9181
+ * It is also possible to set it as the default `paramSerializer` in the
9182
+ * {@link $httpProvider#defaults `$httpProvider`}.
9183
+ *
9184
+ * Additionally, you can inject the serializer and use it explicitly, for example to serialize
9185
+ * form data for submission:
9186
+ *
9187
+ * ```js
9188
+ * .controller(function($http, $httpParamSerializerJQLike) {
9189
+ * //...
9190
+ *
9191
+ * $http({
9192
+ * url: myUrl,
9193
+ * method: 'POST',
9194
+ * data: $httpParamSerializerJQLike(myData),
9195
+ * headers: {
9196
+ * 'Content-Type': 'application/x-www-form-urlencoded'
9197
+ * }
9198
+ * });
9199
+ *
9200
+ * });
9201
+ * ```
9202
+ *
9117
9203
  * */
9118
9204
  this.$get = function() {
9119
9205
  return function jQueryLikeParamSerializer(params) {
@@ -9287,10 +9373,11 @@ function $HttpProvider() {
9287
9373
  * - **`defaults.headers.put`**
9288
9374
  * - **`defaults.headers.patch`**
9289
9375
  *
9290
- * - **`defaults.paramSerializer`** - {string|function(Object<string,string>):string} - A function used to prepare string representation
9291
- * of request parameters (specified as an object).
9292
- * If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.
9293
- * Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.
9376
+ *
9377
+ * - **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function
9378
+ * used to the prepare string representation of request parameters (specified as an object).
9379
+ * If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.
9380
+ * Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.
9294
9381
  *
9295
9382
  **/
9296
9383
  var defaults = this.defaults = {
@@ -9756,15 +9843,17 @@ function $HttpProvider() {
9756
9843
  * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,
9757
9844
  * or the per-request config object.
9758
9845
  *
9846
+ * In order to prevent collisions in environments where multiple Angular apps share the
9847
+ * same domain or subdomain, we recommend that each application uses unique cookie name.
9848
+ *
9759
9849
  *
9760
9850
  * @param {object} config Object describing the request to be made and how it should be
9761
9851
  * processed. The object has following properties:
9762
9852
  *
9763
9853
  * - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)
9764
9854
  * - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.
9765
- * - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be turned
9766
- * to `?key1=value1&key2=value2` after the url. If the value is not a string, it will be
9767
- * JSONified.
9855
+ * - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be serialized
9856
+ * with the `paramSerializer` and appended as GET parameters.
9768
9857
  * - **data** – `{string|Object}` – Data to be sent as the request message data.
9769
9858
  * - **headers** – `{Object}` – Map of strings or functions which return strings representing
9770
9859
  * HTTP headers to send to the server. If the return value of a function is null, the
@@ -9782,10 +9871,14 @@ function $HttpProvider() {
9782
9871
  * transform function or an array of such functions. The transform function takes the http
9783
9872
  * response body, headers and status and returns its transformed (typically deserialized) version.
9784
9873
  * See {@link ng.$http#overriding-the-default-transformations-per-request
9785
- * Overriding the Default Transformations}
9786
- * - **paramSerializer** - {string|function(Object<string,string>):string} - A function used to prepare string representation
9787
- * of request parameters (specified as an object).
9788
- * Is specified as string, it is interpreted as function registered in with the {$injector}.
9874
+ * Overriding the Default TransformationjqLiks}
9875
+ * - **paramSerializer** - `{string|function(Object<string,string>):string}` - A function used to
9876
+ * prepare the string representation of request parameters (specified as an object).
9877
+ * If specified as string, it is interpreted as function registered with the
9878
+ * {@link $injector $injector}, which means you can create your own serializer
9879
+ * by registering it as a {@link auto.$provide#service service}.
9880
+ * The default serializer is the {@link $httpParamSerializer $httpParamSerializer};
9881
+ * alternatively, you can use the {@link $httpParamSerializerJQLike $httpParamSerializerJQLike}
9789
9882
  * - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
9790
9883
  * GET request, otherwise if a cache instance built with
9791
9884
  * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
@@ -13213,8 +13306,10 @@ ASTCompiler.prototype = {
13213
13306
  nameId.name = ast.property.name;
13214
13307
  }
13215
13308
  }
13216
- recursionFn(intoId);
13309
+ }, function() {
13310
+ self.assign(intoId, 'undefined');
13217
13311
  });
13312
+ recursionFn(intoId);
13218
13313
  }, !!create);
13219
13314
  break;
13220
13315
  case AST.CallExpression:
@@ -13252,8 +13347,10 @@ ASTCompiler.prototype = {
13252
13347
  }
13253
13348
  expression = self.ensureSafeObject(expression);
13254
13349
  self.assign(intoId, expression);
13255
- recursionFn(intoId);
13350
+ }, function() {
13351
+ self.assign(intoId, 'undefined');
13256
13352
  });
13353
+ recursionFn(intoId);
13257
13354
  });
13258
13355
  }
13259
13356
  break;
@@ -14634,6 +14731,19 @@ function qFactory(nextTick, exceptionHandler) {
14634
14731
  return result.promise.then(callback, errback, progressBack);
14635
14732
  };
14636
14733
 
14734
+ /**
14735
+ * @ngdoc method
14736
+ * @name $q#resolve
14737
+ * @kind function
14738
+ *
14739
+ * @description
14740
+ * Alias of {@link ng.$q#when when} to maintain naming consistency with ES6.
14741
+ *
14742
+ * @param {*} value Value or a promise
14743
+ * @returns {Promise} Returns a promise of the passed value or promise
14744
+ */
14745
+ var resolve = when;
14746
+
14637
14747
  /**
14638
14748
  * @ngdoc method
14639
14749
  * @name $q#all
@@ -14702,6 +14812,7 @@ function qFactory(nextTick, exceptionHandler) {
14702
14812
  $Q.defer = defer;
14703
14813
  $Q.reject = reject;
14704
14814
  $Q.when = when;
14815
+ $Q.resolve = resolve;
14705
14816
  $Q.all = all;
14706
14817
 
14707
14818
  return $Q;
@@ -18011,9 +18122,11 @@ function $FilterProvider($provide) {
18011
18122
  * `{name: {first: 'John', last: 'Doe'}}` will **not** be matched by `{name: 'John'}`, but
18012
18123
  * **will** be matched by `{$: 'John'}`.
18013
18124
  *
18014
- * - `function(value, index)`: A predicate function can be used to write arbitrary filters. The
18015
- * function is called for each element of `array`. The final result is an array of those
18016
- * elements that the predicate returned true for.
18125
+ * - `function(value, index, array)`: A predicate function can be used to write arbitrary filters.
18126
+ * The function is called for each element of the array, with the element, its index, and
18127
+ * the entire array itself as arguments.
18128
+ *
18129
+ * The final result is an array of those elements that the predicate returned true for.
18017
18130
  *
18018
18131
  * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in
18019
18132
  * determining if the expected value (from the filter expression) and actual value (from
@@ -18314,9 +18427,10 @@ function currencyFilter($locale) {
18314
18427
  * @description
18315
18428
  * Formats a number as text.
18316
18429
  *
18430
+ * If the input is null or undefined, it will just be returned.
18431
+ * If the input is infinite (Infinity/-Infinity) the Infinity symbol '∞' is returned.
18317
18432
  * If the input is not a number an empty string is returned.
18318
18433
  *
18319
- * If the input is an infinite (Infinity/-Infinity) the Infinity symbol '∞' is returned.
18320
18434
  *
18321
18435
  * @param {number|string} number Number to format.
18322
18436
  * @param {(number|string)=} fractionSize Number of decimal places to round the number to.
@@ -18945,7 +19059,7 @@ function limitToFilter() {
18945
19059
  * @description
18946
19060
  * Orders a specified `array` by the `expression` predicate. It is ordered alphabetically
18947
19061
  * for strings and numerically for numbers. Note: if you notice numbers are not being sorted
18948
- * correctly, make sure they are actually being saved as numbers and not strings.
19062
+ * as expected, make sure they are actually being saved as numbers and not strings.
18949
19063
  *
18950
19064
  * @param {Array} array The array to sort.
18951
19065
  * @param {function(*)|string|Array.<(function(*)|string)>=} expression A predicate to be
@@ -19020,19 +19134,40 @@ function limitToFilter() {
19020
19134
  {name:'Mike', phone:'555-4321', age:21},
19021
19135
  {name:'Adam', phone:'555-5678', age:35},
19022
19136
  {name:'Julie', phone:'555-8765', age:29}];
19023
- $scope.predicate = '-age';
19137
+ $scope.predicate = 'age';
19138
+ $scope.reverse = true;
19139
+ $scope.order = function(predicate) {
19140
+ $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
19141
+ $scope.predicate = predicate;
19142
+ };
19024
19143
  }]);
19025
19144
  </script>
19145
+ <style type="text/css">
19146
+ .sortorder:after {
19147
+ content: '\25b2';
19148
+ }
19149
+ .sortorder.reverse:after {
19150
+ content: '\25bc';
19151
+ }
19152
+ </style>
19026
19153
  <div ng-controller="ExampleController">
19027
19154
  <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
19028
19155
  <hr/>
19029
19156
  [ <a href="" ng-click="predicate=''">unsorted</a> ]
19030
19157
  <table class="friend">
19031
19158
  <tr>
19032
- <th><a href="" ng-click="predicate = 'name'; reverse=false">Name</a>
19033
- (<a href="" ng-click="predicate = '-name'; reverse=false">^</a>)</th>
19034
- <th><a href="" ng-click="predicate = 'phone'; reverse=!reverse">Phone Number</a></th>
19035
- <th><a href="" ng-click="predicate = 'age'; reverse=!reverse">Age</a></th>
19159
+ <th>
19160
+ <a href="" ng-click="order('name')">Name</a>
19161
+ <span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
19162
+ </th>
19163
+ <th>
19164
+ <a href="" ng-click="order('phone')">Phone Number</a>
19165
+ <span class="sortorder" ng-show="predicate === 'phone'" ng-class="{reverse:reverse}"></span>
19166
+ </th>
19167
+ <th>
19168
+ <a href="" ng-click="order('age')">Age</a>
19169
+ <span class="sortorder" ng-show="predicate === 'age'" ng-class="{reverse:reverse}"></span>
19170
+ </th>
19036
19171
  </tr>
19037
19172
  <tr ng-repeat="friend in friends | orderBy:predicate:reverse">
19038
19173
  <td>{{friend.name}}</td>
@@ -20195,7 +20330,7 @@ var ngFormDirective = formDirectiveFactory(true);
20195
20330
  var ISO_DATE_REGEXP = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/;
20196
20331
  var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
20197
20332
  var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
20198
- var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/;
20333
+ var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/;
20199
20334
  var DATE_REGEXP = /^(\d{4})-(\d{2})-(\d{2})$/;
20200
20335
  var DATETIMELOCAL_REGEXP = /^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/;
20201
20336
  var WEEK_REGEXP = /^(\d{4})-W(\d\d)$/;
@@ -20794,6 +20929,16 @@ var inputType = {
20794
20929
  * error docs for more information and an example of how to convert your model if necessary.
20795
20930
  * </div>
20796
20931
  *
20932
+ * ## Issues with HTML5 constraint validation
20933
+ *
20934
+ * In browsers that follow the
20935
+ * [HTML5 specification](https://html.spec.whatwg.org/multipage/forms.html#number-state-%28type=number%29),
20936
+ * `input[number]` does not work as expected with {@link ngModelOptions `ngModelOptions.allowInvalid`}.
20937
+ * If a non-number is entered in the input, the browser will report the value as an empty string,
20938
+ * which means the view / model values in `ngModel` and subsequently the scope value
20939
+ * will also be an empty string.
20940
+ *
20941
+ *
20797
20942
  * @param {string} ngModel Assignable angular expression to data-bind to.
20798
20943
  * @param {string=} name Property name of the form under which the control is published.
20799
20944
  * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
@@ -22330,7 +22475,7 @@ function classDirective(name, selector) {
22330
22475
  * @example Example that demonstrates basic bindings via ngClass directive.
22331
22476
  <example>
22332
22477
  <file name="index.html">
22333
- <p ng-class="{strike: deleted, bold: important, red: error}">Map Syntax Example</p>
22478
+ <p ng-class="{strike: deleted, bold: important, 'has-error': error}">Map Syntax Example</p>
22334
22479
  <label>
22335
22480
  <input type="checkbox" ng-model="deleted">
22336
22481
  deleted (apply "strike" class)
@@ -22341,7 +22486,7 @@ function classDirective(name, selector) {
22341
22486
  </label><br>
22342
22487
  <label>
22343
22488
  <input type="checkbox" ng-model="error">
22344
- error (apply "red" class)
22489
+ error (apply "has-error" class)
22345
22490
  </label>
22346
22491
  <hr>
22347
22492
  <p ng-class="style">Using String Syntax</p>
@@ -22370,6 +22515,10 @@ function classDirective(name, selector) {
22370
22515
  .red {
22371
22516
  color: red;
22372
22517
  }
22518
+ .has-error {
22519
+ color: red;
22520
+ background-color: yellow;
22521
+ }
22373
22522
  .orange {
22374
22523
  color: orange;
22375
22524
  }
@@ -22380,13 +22529,13 @@ function classDirective(name, selector) {
22380
22529
  it('should let you toggle the class', function() {
22381
22530
 
22382
22531
  expect(ps.first().getAttribute('class')).not.toMatch(/bold/);
22383
- expect(ps.first().getAttribute('class')).not.toMatch(/red/);
22532
+ expect(ps.first().getAttribute('class')).not.toMatch(/has-error/);
22384
22533
 
22385
22534
  element(by.model('important')).click();
22386
22535
  expect(ps.first().getAttribute('class')).toMatch(/bold/);
22387
22536
 
22388
22537
  element(by.model('error')).click();
22389
- expect(ps.first().getAttribute('class')).toMatch(/red/);
22538
+ expect(ps.first().getAttribute('class')).toMatch(/has-error/);
22390
22539
  });
22391
22540
 
22392
22541
  it('should let you toggle string example', function() {
@@ -25220,7 +25369,7 @@ var DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/;
25220
25369
  * - `debounce`: integer value which contains the debounce model update value in milliseconds. A
25221
25370
  * value of 0 triggers an immediate update. If an object is supplied instead, you can specify a
25222
25371
  * custom value for each event. For example:
25223
- * `ng-model-options="{ updateOn: 'default blur', debounce: {'default': 500, 'blur': 0} }"`
25372
+ * `ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 500, 'blur': 0 } }"`
25224
25373
  * - `allowInvalid`: boolean value which indicates that the model can be set with values that did
25225
25374
  * not validate correctly instead of the default behavior of setting the model to undefined.
25226
25375
  * - `getterSetter`: boolean value which determines whether or not to treat functions bound to
@@ -25470,7 +25619,9 @@ function addSetValidityMethod(context) {
25470
25619
  function isObjectEmpty(obj) {
25471
25620
  if (obj) {
25472
25621
  for (var prop in obj) {
25473
- return false;
25622
+ if (obj.hasOwnProperty(prop)) {
25623
+ return false;
25624
+ }
25474
25625
  }
25475
25626
  }
25476
25627
  return true;
@@ -25813,6 +25964,7 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
25813
25964
  values = values || [];
25814
25965
 
25815
25966
  Object.keys(values).forEach(function getWatchable(key) {
25967
+ if (key.charAt(0) === '$') return;
25816
25968
  var locals = getLocals(values[key], key);
25817
25969
  var selectValue = getTrackByValueFn(values[key], locals);
25818
25970
  watchedArray.push(selectValue);
@@ -26216,8 +26368,7 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
26216
26368
  // Check to see if the value has changed due to the update to the options
26217
26369
  if (!ngModelCtrl.$isEmpty(previousValue)) {
26218
26370
  var nextValue = selectCtrl.readValue();
26219
- if (ngOptions.trackBy && !equals(previousValue, nextValue) ||
26220
- previousValue !== nextValue) {
26371
+ if (ngOptions.trackBy ? !equals(previousValue, nextValue) : previousValue !== nextValue) {
26221
26372
  ngModelCtrl.$setViewValue(nextValue);
26222
26373
  ngModelCtrl.$render();
26223
26374
  }
@@ -26565,6 +26716,15 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
26565
26716
  * </div>
26566
26717
  * ```
26567
26718
  *
26719
+ * <div class="alert alert-warning">
26720
+ * **Note:** `track by` must always be the last expression:
26721
+ * </div>
26722
+ * ```
26723
+ * <div ng-repeat="model in collection | orderBy: 'id' as filtered_result track by model.id">
26724
+ * {{model.name}}
26725
+ * </div>
26726
+ * ```
26727
+ *
26568
26728
  * # Special repeat start and end points
26569
26729
  * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending
26570
26730
  * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.
@@ -26636,8 +26796,9 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
26636
26796
  * which can be used to associate the objects in the collection with the DOM elements. If no tracking expression
26637
26797
  * is specified, ng-repeat associates elements by identity. It is an error to have
26638
26798
  * more than one tracking expression value resolve to the same key. (This would mean that two distinct objects are
26639
- * mapped to the same DOM element, which is not possible.) If filters are used in the expression, they should be
26640
- * applied before the tracking expression.
26799
+ * mapped to the same DOM element, which is not possible.)
26800
+ *
26801
+ * Note that the tracking expression must come last, after any filters, and the alias expression.
26641
26802
  *
26642
26803
  * For example: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements
26643
26804
  * will be associated by item identity in the array.