angularjs-rails 1.4.3 → 1.4.4

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.4.3
2
+ * @license AngularJS v1.4.4
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.3
2
+ * @license AngularJS v1.4.4
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.3/' +
60
+ message += '\nhttp://errors.angularjs.org/1.4.4/' +
61
61
  (module ? module + '/' : '') + code;
62
62
 
63
63
  for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
@@ -423,6 +423,8 @@ function baseExtend(dst, objs, deep) {
423
423
  if (deep && isObject(src)) {
424
424
  if (isDate(src)) {
425
425
  dst[key] = new Date(src.valueOf());
426
+ } else if (isRegExp(src)) {
427
+ dst[key] = new RegExp(src);
426
428
  } else {
427
429
  if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
428
430
  baseExtend(dst[key], [src], true);
@@ -1053,22 +1055,39 @@ function equals(o1, o2) {
1053
1055
  }
1054
1056
 
1055
1057
  var csp = function() {
1056
- if (isDefined(csp.isActive_)) return csp.isActive_;
1058
+ if (!isDefined(csp.rules)) {
1057
1059
 
1058
- var active = !!(document.querySelector('[ng-csp]') ||
1059
- document.querySelector('[data-ng-csp]'));
1060
1060
 
1061
- if (!active) {
1061
+ var ngCspElement = (document.querySelector('[ng-csp]') ||
1062
+ document.querySelector('[data-ng-csp]'));
1063
+
1064
+ if (ngCspElement) {
1065
+ var ngCspAttribute = ngCspElement.getAttribute('ng-csp') ||
1066
+ ngCspElement.getAttribute('data-ng-csp');
1067
+ csp.rules = {
1068
+ noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1),
1069
+ noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1)
1070
+ };
1071
+ } else {
1072
+ csp.rules = {
1073
+ noUnsafeEval: noUnsafeEval(),
1074
+ noInlineStyle: false
1075
+ };
1076
+ }
1077
+ }
1078
+
1079
+ return csp.rules;
1080
+
1081
+ function noUnsafeEval() {
1062
1082
  try {
1063
1083
  /* jshint -W031, -W054 */
1064
1084
  new Function('');
1065
1085
  /* jshint +W031, +W054 */
1086
+ return false;
1066
1087
  } catch (e) {
1067
- active = true;
1088
+ return true;
1068
1089
  }
1069
1090
  }
1070
-
1071
- return (csp.isActive_ = active);
1072
1091
  };
1073
1092
 
1074
1093
  /**
@@ -1300,13 +1319,19 @@ function tryDecodeURIComponent(value) {
1300
1319
  * @returns {Object.<string,boolean|Array>}
1301
1320
  */
1302
1321
  function parseKeyValue(/**string*/keyValue) {
1303
- var obj = {}, key_value, key;
1322
+ var obj = {};
1304
1323
  forEach((keyValue || "").split('&'), function(keyValue) {
1324
+ var splitPoint, key, val;
1305
1325
  if (keyValue) {
1306
- key_value = keyValue.replace(/\+/g,'%20').split('=');
1307
- key = tryDecodeURIComponent(key_value[0]);
1326
+ key = keyValue = keyValue.replace(/\+/g,'%20');
1327
+ splitPoint = keyValue.indexOf('=');
1328
+ if (splitPoint !== -1) {
1329
+ key = keyValue.substring(0, splitPoint);
1330
+ val = keyValue.substring(splitPoint + 1);
1331
+ }
1332
+ key = tryDecodeURIComponent(key);
1308
1333
  if (isDefined(key)) {
1309
- var val = isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true;
1334
+ val = isDefined(val) ? tryDecodeURIComponent(val) : true;
1310
1335
  if (!hasOwnProperty.call(obj, key)) {
1311
1336
  obj[key] = val;
1312
1337
  } else if (isArray(obj[key])) {
@@ -1902,8 +1927,8 @@ function setupModuleLoader(window) {
1902
1927
  * All modules (angular core or 3rd party) that should be available to an application must be
1903
1928
  * registered using this mechanism.
1904
1929
  *
1905
- * When passed two or more arguments, a new module is created. If passed only one argument, an
1906
- * existing module (the name passed as the first argument to `module`) is retrieved.
1930
+ * Passing one argument retrieves an existing {@link angular.Module},
1931
+ * whereas passing more than one argument creates a new {@link angular.Module}
1907
1932
  *
1908
1933
  *
1909
1934
  * # Module
@@ -2244,7 +2269,6 @@ function toDebugString(obj) {
2244
2269
  /* global angularModule: true,
2245
2270
  version: true,
2246
2271
 
2247
- $LocaleProvider,
2248
2272
  $CompileProvider,
2249
2273
 
2250
2274
  htmlAnchorDirective,
@@ -2261,7 +2285,6 @@ function toDebugString(obj) {
2261
2285
  ngClassDirective,
2262
2286
  ngClassEvenDirective,
2263
2287
  ngClassOddDirective,
2264
- ngCspDirective,
2265
2288
  ngCloakDirective,
2266
2289
  ngControllerDirective,
2267
2290
  ngFormDirective,
@@ -2298,6 +2321,7 @@ function toDebugString(obj) {
2298
2321
 
2299
2322
  $AnchorScrollProvider,
2300
2323
  $AnimateProvider,
2324
+ $CoreAnimateCssProvider,
2301
2325
  $$CoreAnimateQueueProvider,
2302
2326
  $$CoreAnimateRunnerProvider,
2303
2327
  $BrowserProvider,
@@ -2306,6 +2330,7 @@ function toDebugString(obj) {
2306
2330
  $DocumentProvider,
2307
2331
  $ExceptionHandlerProvider,
2308
2332
  $FilterProvider,
2333
+ $$ForceReflowProvider,
2309
2334
  $InterpolateProvider,
2310
2335
  $IntervalProvider,
2311
2336
  $$HashMapProvider,
@@ -2349,11 +2374,11 @@ function toDebugString(obj) {
2349
2374
  * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
2350
2375
  */
2351
2376
  var version = {
2352
- full: '1.4.3', // all of these placeholder strings will be replaced by grunt's
2377
+ full: '1.4.4', // all of these placeholder strings will be replaced by grunt's
2353
2378
  major: 1, // package task
2354
2379
  minor: 4,
2355
- dot: 3,
2356
- codeName: 'foam-acceleration'
2380
+ dot: 4,
2381
+ codeName: 'pylon-requirement'
2357
2382
  };
2358
2383
 
2359
2384
 
@@ -2392,11 +2417,6 @@ function publishExternalAPI(angular) {
2392
2417
  });
2393
2418
 
2394
2419
  angularModule = setupModuleLoader(window);
2395
- try {
2396
- angularModule('ngLocale');
2397
- } catch (e) {
2398
- angularModule('ngLocale', []).provider('$locale', $LocaleProvider);
2399
- }
2400
2420
 
2401
2421
  angularModule('ng', ['ngLocale'], ['$provide',
2402
2422
  function ngModule($provide) {
@@ -2459,6 +2479,7 @@ function publishExternalAPI(angular) {
2459
2479
  $provide.provider({
2460
2480
  $anchorScroll: $AnchorScrollProvider,
2461
2481
  $animate: $AnimateProvider,
2482
+ $animateCss: $CoreAnimateCssProvider,
2462
2483
  $$animateQueue: $$CoreAnimateQueueProvider,
2463
2484
  $$AnimateRunner: $$CoreAnimateRunnerProvider,
2464
2485
  $browser: $BrowserProvider,
@@ -2467,6 +2488,7 @@ function publishExternalAPI(angular) {
2467
2488
  $document: $DocumentProvider,
2468
2489
  $exceptionHandler: $ExceptionHandlerProvider,
2469
2490
  $filter: $FilterProvider,
2491
+ $$forceReflow: $$ForceReflowProvider,
2470
2492
  $interpolate: $InterpolateProvider,
2471
2493
  $interval: $IntervalProvider,
2472
2494
  $http: $HttpProvider,
@@ -3686,7 +3708,7 @@ var $$HashMapProvider = [function() {
3686
3708
  * Implicit module which gets automatically added to each {@link auto.$injector $injector}.
3687
3709
  */
3688
3710
 
3689
- var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
3711
+ var FN_ARGS = /^[^\(]*\(\s*([^\)]*)\)/m;
3690
3712
  var FN_ARG_SPLIT = /,/;
3691
3713
  var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
3692
3714
  var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
@@ -4342,6 +4364,7 @@ function createInjector(modulesToLoad, strictDi) {
4342
4364
  // Module Loading
4343
4365
  ////////////////////////////////////
4344
4366
  function loadModules(modulesToLoad) {
4367
+ assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');
4345
4368
  var runBlocks = [], moduleFn;
4346
4369
  forEach(modulesToLoad, function(module) {
4347
4370
  if (loadedModules.get(module)) return;
@@ -4851,31 +4874,31 @@ var $$CoreAnimateQueueProvider = function() {
4851
4874
  };
4852
4875
 
4853
4876
  function addRemoveClassesPostDigest(element, add, remove) {
4854
- var data = postDigestQueue.get(element);
4855
- var classVal;
4877
+ var classVal, data = postDigestQueue.get(element);
4856
4878
 
4857
4879
  if (!data) {
4858
4880
  postDigestQueue.put(element, data = {});
4859
4881
  postDigestElements.push(element);
4860
4882
  }
4861
4883
 
4862
- if (add) {
4863
- forEach(add.split(' '), function(className) {
4864
- if (className) {
4865
- data[className] = true;
4866
- }
4867
- });
4868
- }
4869
-
4870
- if (remove) {
4871
- forEach(remove.split(' '), function(className) {
4872
- if (className) {
4873
- data[className] = false;
4874
- }
4875
- });
4876
- }
4884
+ var updateData = function(classes, value) {
4885
+ var changed = false;
4886
+ if (classes) {
4887
+ classes = isString(classes) ? classes.split(' ') :
4888
+ isArray(classes) ? classes : [];
4889
+ forEach(classes, function(className) {
4890
+ if (className) {
4891
+ changed = true;
4892
+ data[className] = value;
4893
+ }
4894
+ });
4895
+ }
4896
+ return changed;
4897
+ };
4877
4898
 
4878
- if (postDigestElements.length > 1) return;
4899
+ var classesAdded = updateData(add, true);
4900
+ var classesRemoved = updateData(remove, false);
4901
+ if ((!classesAdded && !classesRemoved) || postDigestElements.length > 1) return;
4879
4902
 
4880
4903
  $rootScope.$$postDigest(function() {
4881
4904
  forEach(postDigestElements, function(element) {
@@ -5334,15 +5357,88 @@ var $AnimateProvider = ['$provide', function($provide) {
5334
5357
  }];
5335
5358
  }];
5336
5359
 
5337
- function $$AsyncCallbackProvider() {
5338
- this.$get = ['$$rAF', '$timeout', function($$rAF, $timeout) {
5339
- return $$rAF.supported
5340
- ? function(fn) { return $$rAF(fn); }
5341
- : function(fn) {
5342
- return $timeout(fn, 0, false);
5360
+ /**
5361
+ * @ngdoc service
5362
+ * @name $animateCss
5363
+ * @kind object
5364
+ *
5365
+ * @description
5366
+ * This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included,
5367
+ * then the `$animateCss` service will actually perform animations.
5368
+ *
5369
+ * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}.
5370
+ */
5371
+ var $CoreAnimateCssProvider = function() {
5372
+ this.$get = ['$$rAF', '$q', function($$rAF, $q) {
5373
+
5374
+ var RAFPromise = function() {};
5375
+ RAFPromise.prototype = {
5376
+ done: function(cancel) {
5377
+ this.defer && this.defer[cancel === true ? 'reject' : 'resolve']();
5378
+ },
5379
+ end: function() {
5380
+ this.done();
5381
+ },
5382
+ cancel: function() {
5383
+ this.done(true);
5384
+ },
5385
+ getPromise: function() {
5386
+ if (!this.defer) {
5387
+ this.defer = $q.defer();
5388
+ }
5389
+ return this.defer.promise;
5390
+ },
5391
+ then: function(f1,f2) {
5392
+ return this.getPromise().then(f1,f2);
5393
+ },
5394
+ 'catch': function(f1) {
5395
+ return this.getPromise().catch(f1);
5396
+ },
5397
+ 'finally': function(f1) {
5398
+ return this.getPromise().finally(f1);
5399
+ }
5400
+ };
5401
+
5402
+ return function(element, options) {
5403
+ if (options.from) {
5404
+ element.css(options.from);
5405
+ options.from = null;
5406
+ }
5407
+
5408
+ var closed, runner = new RAFPromise();
5409
+ return {
5410
+ start: run,
5411
+ end: run
5343
5412
  };
5413
+
5414
+ function run() {
5415
+ $$rAF(function() {
5416
+ close();
5417
+ if (!closed) {
5418
+ runner.done();
5419
+ }
5420
+ closed = true;
5421
+ });
5422
+ return runner;
5423
+ }
5424
+
5425
+ function close() {
5426
+ if (options.addClass) {
5427
+ element.addClass(options.addClass);
5428
+ options.addClass = null;
5429
+ }
5430
+ if (options.removeClass) {
5431
+ element.removeClass(options.removeClass);
5432
+ options.removeClass = null;
5433
+ }
5434
+ if (options.to) {
5435
+ element.css(options.to);
5436
+ options.to = null;
5437
+ }
5438
+ }
5439
+ };
5344
5440
  }];
5345
- }
5441
+ };
5346
5442
 
5347
5443
  /* global stripHash: true */
5348
5444
 
@@ -6506,7 +6602,7 @@ function $TemplateCacheProvider() {
6506
6602
  * otherwise the {@link error:$compile:ctreq Missing Required Controller} error is thrown.
6507
6603
  *
6508
6604
  * Note that you can also require the directive's own controller - it will be made available like
6509
- * like any other controller.
6605
+ * any other controller.
6510
6606
  *
6511
6607
  * * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.
6512
6608
  * This is the same as the `$transclude`
@@ -6532,7 +6628,7 @@ function $TemplateCacheProvider() {
6532
6628
  *
6533
6629
  * ### Transclusion
6534
6630
  *
6535
- * Transclusion is the process of extracting a collection of DOM element from one part of the DOM and
6631
+ * Transclusion is the process of extracting a collection of DOM elements from one part of the DOM and
6536
6632
  * copying them to another part of the DOM, while maintaining their connection to the original AngularJS
6537
6633
  * scope from where they were taken.
6538
6634
  *
@@ -7287,7 +7383,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
7287
7383
 
7288
7384
  listeners.push(fn);
7289
7385
  $rootScope.$evalAsync(function() {
7290
- if (!listeners.$$inter && attrs.hasOwnProperty(key)) {
7386
+ if (!listeners.$$inter && attrs.hasOwnProperty(key) && !isUndefined(attrs[key])) {
7291
7387
  // no one registered attribute interpolation function, so lets call it manually
7292
7388
  fn(attrs[key]);
7293
7389
  }
@@ -8666,24 +8762,19 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
8666
8762
  lastValue,
8667
8763
  parentGet, parentSet, compare;
8668
8764
 
8669
- if (!hasOwnProperty.call(attrs, attrName)) {
8670
- // In the case of user defined a binding with the same name as a method in Object.prototype but didn't set
8671
- // the corresponding attribute. We need to make sure subsequent code won't access to the prototype function
8672
- attrs[attrName] = undefined;
8673
- }
8674
-
8675
8765
  switch (mode) {
8676
8766
 
8677
8767
  case '@':
8678
- if (!attrs[attrName] && !optional) {
8679
- destination[scopeName] = undefined;
8768
+ if (!optional && !hasOwnProperty.call(attrs, attrName)) {
8769
+ destination[scopeName] = attrs[attrName] = void 0;
8680
8770
  }
8681
-
8682
8771
  attrs.$observe(attrName, function(value) {
8683
- destination[scopeName] = value;
8772
+ if (isString(value)) {
8773
+ destination[scopeName] = value;
8774
+ }
8684
8775
  });
8685
8776
  attrs.$$observers[attrName].$$scope = scope;
8686
- if (attrs[attrName]) {
8777
+ if (isString(attrs[attrName])) {
8687
8778
  // If the attribute has been provided then we trigger an interpolation to ensure
8688
8779
  // the value is there for use in the link fn
8689
8780
  destination[scopeName] = $interpolate(attrs[attrName])(scope);
@@ -8691,11 +8782,13 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
8691
8782
  break;
8692
8783
 
8693
8784
  case '=':
8694
- if (optional && !attrs[attrName]) {
8695
- return;
8785
+ if (!hasOwnProperty.call(attrs, attrName)) {
8786
+ if (optional) break;
8787
+ attrs[attrName] = void 0;
8696
8788
  }
8697
- parentGet = $parse(attrs[attrName]);
8789
+ if (optional && !attrs[attrName]) break;
8698
8790
 
8791
+ parentGet = $parse(attrs[attrName]);
8699
8792
  if (parentGet.literal) {
8700
8793
  compare = equals;
8701
8794
  } else {
@@ -8734,7 +8827,8 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
8734
8827
  break;
8735
8828
 
8736
8829
  case '&':
8737
- parentGet = $parse(attrs[attrName]);
8830
+ // Don't assign Object.prototype method to scope
8831
+ parentGet = attrs.hasOwnProperty(attrName) ? $parse(attrs[attrName]) : noop;
8738
8832
 
8739
8833
  // Don't assign noop to destination if expression is not valid
8740
8834
  if (parentGet === noop && optional) break;
@@ -9111,6 +9205,29 @@ function $ExceptionHandlerProvider() {
9111
9205
  }];
9112
9206
  }
9113
9207
 
9208
+ var $$ForceReflowProvider = function() {
9209
+ this.$get = ['$document', function($document) {
9210
+ return function(domNode) {
9211
+ //the line below will force the browser to perform a repaint so
9212
+ //that all the animated elements within the animation frame will
9213
+ //be properly updated and drawn on screen. This is required to
9214
+ //ensure that the preparation animation is properly flushed so that
9215
+ //the active state picks up from there. DO NOT REMOVE THIS LINE.
9216
+ //DO NOT OPTIMIZE THIS LINE. THE MINIFIER WILL REMOVE IT OTHERWISE WHICH
9217
+ //WILL RESULT IN AN UNPREDICTABLE BUG THAT IS VERY HARD TO TRACK DOWN AND
9218
+ //WILL TAKE YEARS AWAY FROM YOUR LIFE.
9219
+ if (domNode) {
9220
+ if (!domNode.nodeType && domNode instanceof jqLite) {
9221
+ domNode = domNode[0];
9222
+ }
9223
+ } else {
9224
+ domNode = $document[0].body;
9225
+ }
9226
+ return domNode.offsetWidth + 1;
9227
+ };
9228
+ }];
9229
+ };
9230
+
9114
9231
  var APPLICATION_JSON = 'application/json';
9115
9232
  var CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': APPLICATION_JSON + ';charset=utf-8'};
9116
9233
  var JSON_START = /^\[|^\{(?!\{)/;
@@ -9119,6 +9236,12 @@ var JSON_ENDS = {
9119
9236
  '{': /}$/
9120
9237
  };
9121
9238
  var JSON_PROTECTION_PREFIX = /^\)\]\}',?\n/;
9239
+ var $httpMinErr = minErr('$http');
9240
+ var $httpMinErrLegacyFn = function(method) {
9241
+ return function() {
9242
+ throw $httpMinErr('legacy', 'The method `{0}` on the promise returned from `$http` has been disabled.', method);
9243
+ };
9244
+ };
9122
9245
 
9123
9246
  function serializeValue(v) {
9124
9247
  if (isObject(v)) {
@@ -9219,8 +9342,8 @@ function $HttpParamSerializerJQLikeProvider() {
9219
9342
  function serialize(toSerialize, prefix, topLevel) {
9220
9343
  if (toSerialize === null || isUndefined(toSerialize)) return;
9221
9344
  if (isArray(toSerialize)) {
9222
- forEach(toSerialize, function(value) {
9223
- serialize(value, prefix + '[]');
9345
+ forEach(toSerialize, function(value, index) {
9346
+ serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']');
9224
9347
  });
9225
9348
  } else if (isObject(toSerialize) && !isDate(toSerialize)) {
9226
9349
  forEachSorted(toSerialize, function(value, key) {
@@ -9441,6 +9564,30 @@ function $HttpProvider() {
9441
9564
  return useApplyAsync;
9442
9565
  };
9443
9566
 
9567
+ var useLegacyPromise = true;
9568
+ /**
9569
+ * @ngdoc method
9570
+ * @name $httpProvider#useLegacyPromiseExtensions
9571
+ * @description
9572
+ *
9573
+ * Configure `$http` service to return promises without the shorthand methods `success` and `error`.
9574
+ * This should be used to make sure that applications work without these methods.
9575
+ *
9576
+ * Defaults to false. If no value is specified, returns the current configured value.
9577
+ *
9578
+ * @param {boolean=} value If true, `$http` will return a normal promise without the `success` and `error` methods.
9579
+ *
9580
+ * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.
9581
+ * otherwise, returns the current configured value.
9582
+ **/
9583
+ this.useLegacyPromiseExtensions = function(value) {
9584
+ if (isDefined(value)) {
9585
+ useLegacyPromise = !!value;
9586
+ return this;
9587
+ }
9588
+ return useLegacyPromise;
9589
+ };
9590
+
9444
9591
  /**
9445
9592
  * @ngdoc property
9446
9593
  * @name $httpProvider#interceptors
@@ -9507,17 +9654,15 @@ function $HttpProvider() {
9507
9654
  *
9508
9655
  * ## General usage
9509
9656
  * The `$http` service is a function which takes a single argument — a configuration object —
9510
- * that is used to generate an HTTP request and returns a {@link ng.$q promise}
9511
- * with two $http specific methods: `success` and `error`.
9657
+ * that is used to generate an HTTP request and returns a {@link ng.$q promise}.
9512
9658
  *
9513
9659
  * ```js
9514
9660
  * // Simple GET request example :
9515
9661
  * $http.get('/someUrl').
9516
- * success(function(data, status, headers, config) {
9662
+ * then(function(response) {
9517
9663
  * // this callback will be called asynchronously
9518
9664
  * // when the response is available
9519
- * }).
9520
- * error(function(data, status, headers, config) {
9665
+ * }, function(response) {
9521
9666
  * // called asynchronously if an error occurs
9522
9667
  * // or server returns response with an error status.
9523
9668
  * });
@@ -9526,21 +9671,23 @@ function $HttpProvider() {
9526
9671
  * ```js
9527
9672
  * // Simple POST request example (passing data) :
9528
9673
  * $http.post('/someUrl', {msg:'hello word!'}).
9529
- * success(function(data, status, headers, config) {
9674
+ * then(function(response) {
9530
9675
  * // this callback will be called asynchronously
9531
9676
  * // when the response is available
9532
- * }).
9533
- * error(function(data, status, headers, config) {
9677
+ * }, function(response) {
9534
9678
  * // called asynchronously if an error occurs
9535
9679
  * // or server returns response with an error status.
9536
9680
  * });
9537
9681
  * ```
9538
9682
  *
9683
+ * The response object has these properties:
9539
9684
  *
9540
- * Since the returned value of calling the $http function is a `promise`, you can also use
9541
- * the `then` method to register callbacks, and these callbacks will receive a single argument –
9542
- * an object representing the response. See the API signature and type info below for more
9543
- * details.
9685
+ * - **data** `{string|Object}` The response body transformed with the transform
9686
+ * functions.
9687
+ * - **status** `{number}` HTTP status code of the response.
9688
+ * - **headers** – `{function([headerName])}` – Header getter function.
9689
+ * - **config** – `{Object}` – The configuration object that was used to generate the request.
9690
+ * - **statusText** – `{string}` – HTTP status text of the response.
9544
9691
  *
9545
9692
  * A response status code between 200 and 299 is considered a success status and
9546
9693
  * will result in the success callback being called. Note that if the response is a redirect,
@@ -9564,8 +9711,8 @@ function $HttpProvider() {
9564
9711
  * request data must be passed in for POST/PUT requests.
9565
9712
  *
9566
9713
  * ```js
9567
- * $http.get('/someUrl').success(successCallback);
9568
- * $http.post('/someUrl', data).success(successCallback);
9714
+ * $http.get('/someUrl').then(successCallback);
9715
+ * $http.post('/someUrl', data).then(successCallback);
9569
9716
  * ```
9570
9717
  *
9571
9718
  * Complete list of shortcut methods:
@@ -9579,6 +9726,14 @@ function $HttpProvider() {
9579
9726
  * - {@link ng.$http#patch $http.patch}
9580
9727
  *
9581
9728
  *
9729
+ * ## Deprecation Notice
9730
+ * <div class="alert alert-danger">
9731
+ * The `$http` legacy promise methods `success` and `error` have been deprecated.
9732
+ * Use the standard `then` method instead.
9733
+ * If {@link $httpProvider#useLegacyPromiseExtensions `$httpProvider.useLegacyPromiseExtensions`} is set to
9734
+ * `false` then these methods will throw {@link $http:legacy `$http/legacy`} error.
9735
+ * </div>
9736
+ *
9582
9737
  * ## Setting HTTP Headers
9583
9738
  *
9584
9739
  * The $http service will automatically add certain HTTP headers to all requests. These defaults
@@ -9622,7 +9777,7 @@ function $HttpProvider() {
9622
9777
  * data: { test: 'test' }
9623
9778
  * }
9624
9779
  *
9625
- * $http(req).success(function(){...}).error(function(){...});
9780
+ * $http(req).then(function(){...}, function(){...});
9626
9781
  * ```
9627
9782
  *
9628
9783
  * ## Transforming Requests and Responses
@@ -9854,7 +10009,6 @@ function $HttpProvider() {
9854
10009
  * In order to prevent collisions in environments where multiple Angular apps share the
9855
10010
  * same domain or subdomain, we recommend that each application uses unique cookie name.
9856
10011
  *
9857
- *
9858
10012
  * @param {object} config Object describing the request to be made and how it should be
9859
10013
  * processed. The object has following properties:
9860
10014
  *
@@ -9899,20 +10053,9 @@ function $HttpProvider() {
9899
10053
  * - **responseType** - `{string}` - see
9900
10054
  * [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype).
9901
10055
  *
9902
- * @returns {HttpPromise} Returns a {@link ng.$q promise} object with the
9903
- * standard `then` method and two http specific methods: `success` and `error`. The `then`
9904
- * method takes two arguments a success and an error callback which will be called with a
9905
- * response object. The `success` and `error` methods take a single argument - a function that
9906
- * will be called when the request succeeds or fails respectively. The arguments passed into
9907
- * these functions are destructured representation of the response object passed into the
9908
- * `then` method. The response object has these properties:
10056
+ * @returns {HttpPromise} Returns a {@link ng.$q `Promise}` that will be resolved to a response object
10057
+ * when the request succeeds or fails.
9909
10058
  *
9910
- * - **data** – `{string|Object}` – The response body transformed with the transform
9911
- * functions.
9912
- * - **status** – `{number}` – HTTP status code of the response.
9913
- * - **headers** – `{function([headerName])}` – Header getter function.
9914
- * - **config** – `{Object}` – The configuration object that was used to generate the request.
9915
- * - **statusText** – `{string}` – HTTP status text of the response.
9916
10059
  *
9917
10060
  * @property {Array.<Object>} pendingRequests Array of config objects for currently pending
9918
10061
  * requests. This is primarily meant to be used for debugging purposes.
@@ -9954,13 +10097,12 @@ function $HttpProvider() {
9954
10097
  $scope.response = null;
9955
10098
 
9956
10099
  $http({method: $scope.method, url: $scope.url, cache: $templateCache}).
9957
- success(function(data, status) {
9958
- $scope.status = status;
9959
- $scope.data = data;
9960
- }).
9961
- error(function(data, status) {
9962
- $scope.data = data || "Request failed";
9963
- $scope.status = status;
10100
+ then(function(response) {
10101
+ $scope.status = response.status;
10102
+ $scope.data = response.data;
10103
+ }, function(response) {
10104
+ $scope.data = response.data || "Request failed";
10105
+ $scope.status = response.status;
9964
10106
  });
9965
10107
  };
9966
10108
 
@@ -10065,23 +10207,28 @@ function $HttpProvider() {
10065
10207
  promise = promise.then(thenFn, rejectFn);
10066
10208
  }
10067
10209
 
10068
- promise.success = function(fn) {
10069
- assertArgFn(fn, 'fn');
10210
+ if (useLegacyPromise) {
10211
+ promise.success = function(fn) {
10212
+ assertArgFn(fn, 'fn');
10070
10213
 
10071
- promise.then(function(response) {
10072
- fn(response.data, response.status, response.headers, config);
10073
- });
10074
- return promise;
10075
- };
10214
+ promise.then(function(response) {
10215
+ fn(response.data, response.status, response.headers, config);
10216
+ });
10217
+ return promise;
10218
+ };
10076
10219
 
10077
- promise.error = function(fn) {
10078
- assertArgFn(fn, 'fn');
10220
+ promise.error = function(fn) {
10221
+ assertArgFn(fn, 'fn');
10079
10222
 
10080
- promise.then(null, function(response) {
10081
- fn(response.data, response.status, response.headers, config);
10082
- });
10083
- return promise;
10084
- };
10223
+ promise.then(null, function(response) {
10224
+ fn(response.data, response.status, response.headers, config);
10225
+ });
10226
+ return promise;
10227
+ };
10228
+ } else {
10229
+ promise.success = $httpMinErrLegacyFn('success');
10230
+ promise.error = $httpMinErrLegacyFn('error');
10231
+ }
10085
10232
 
10086
10233
  return promise;
10087
10234
 
@@ -10460,7 +10607,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
10460
10607
  xhr.onload = function requestLoaded() {
10461
10608
  var statusText = xhr.statusText || '';
10462
10609
 
10463
- // responseText is the old-school way of retrieving response (supported by IE8 & 9)
10610
+ // responseText is the old-school way of retrieving response (supported by IE9)
10464
10611
  // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)
10465
10612
  var response = ('response' in xhr) ? xhr.response : xhr.responseText;
10466
10613
 
@@ -11098,7 +11245,7 @@ function $IntervalProvider() {
11098
11245
  * @description
11099
11246
  * Cancels a task associated with the `promise`.
11100
11247
  *
11101
- * @param {promise} promise returned by the `$interval` function.
11248
+ * @param {Promise=} promise returned by the `$interval` function.
11102
11249
  * @returns {boolean} Returns `true` if the task was successfully canceled.
11103
11250
  */
11104
11251
  interval.cancel = function(promise) {
@@ -11125,75 +11272,6 @@ function $IntervalProvider() {
11125
11272
  *
11126
11273
  * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)
11127
11274
  */
11128
- function $LocaleProvider() {
11129
- this.$get = function() {
11130
- return {
11131
- id: 'en-us',
11132
-
11133
- NUMBER_FORMATS: {
11134
- DECIMAL_SEP: '.',
11135
- GROUP_SEP: ',',
11136
- PATTERNS: [
11137
- { // Decimal Pattern
11138
- minInt: 1,
11139
- minFrac: 0,
11140
- maxFrac: 3,
11141
- posPre: '',
11142
- posSuf: '',
11143
- negPre: '-',
11144
- negSuf: '',
11145
- gSize: 3,
11146
- lgSize: 3
11147
- },{ //Currency Pattern
11148
- minInt: 1,
11149
- minFrac: 2,
11150
- maxFrac: 2,
11151
- posPre: '\u00A4',
11152
- posSuf: '',
11153
- negPre: '(\u00A4',
11154
- negSuf: ')',
11155
- gSize: 3,
11156
- lgSize: 3
11157
- }
11158
- ],
11159
- CURRENCY_SYM: '$'
11160
- },
11161
-
11162
- DATETIME_FORMATS: {
11163
- MONTH:
11164
- 'January,February,March,April,May,June,July,August,September,October,November,December'
11165
- .split(','),
11166
- SHORTMONTH: 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','),
11167
- DAY: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','),
11168
- SHORTDAY: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(','),
11169
- AMPMS: ['AM','PM'],
11170
- medium: 'MMM d, y h:mm:ss a',
11171
- 'short': 'M/d/yy h:mm a',
11172
- fullDate: 'EEEE, MMMM d, y',
11173
- longDate: 'MMMM d, y',
11174
- mediumDate: 'MMM d, y',
11175
- shortDate: 'M/d/yy',
11176
- mediumTime: 'h:mm:ss a',
11177
- shortTime: 'h:mm a',
11178
- ERANAMES: [
11179
- "Before Christ",
11180
- "Anno Domini"
11181
- ],
11182
- ERAS: [
11183
- "BC",
11184
- "AD"
11185
- ]
11186
- },
11187
-
11188
- pluralCat: function(num) {
11189
- if (num === 1) {
11190
- return 'one';
11191
- }
11192
- return 'other';
11193
- }
11194
- };
11195
- };
11196
- }
11197
11275
 
11198
11276
  var PATH_MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/,
11199
11277
  DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
@@ -11284,12 +11362,12 @@ function serverBase(url) {
11284
11362
  *
11285
11363
  * @constructor
11286
11364
  * @param {string} appBase application base URL
11365
+ * @param {string} appBaseNoFile application base URL stripped of any filename
11287
11366
  * @param {string} basePrefix url path prefix
11288
11367
  */
11289
- function LocationHtml5Url(appBase, basePrefix) {
11368
+ function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {
11290
11369
  this.$$html5 = true;
11291
11370
  basePrefix = basePrefix || '';
11292
- var appBaseNoFile = stripFile(appBase);
11293
11371
  parseAbsoluteUrl(appBase, this);
11294
11372
 
11295
11373
 
@@ -11363,10 +11441,10 @@ function LocationHtml5Url(appBase, basePrefix) {
11363
11441
  *
11364
11442
  * @constructor
11365
11443
  * @param {string} appBase application base URL
11444
+ * @param {string} appBaseNoFile application base URL stripped of any filename
11366
11445
  * @param {string} hashPrefix hashbang prefix
11367
11446
  */
11368
- function LocationHashbangUrl(appBase, hashPrefix) {
11369
- var appBaseNoFile = stripFile(appBase);
11447
+ function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
11370
11448
 
11371
11449
  parseAbsoluteUrl(appBase, this);
11372
11450
 
@@ -11475,14 +11553,13 @@ function LocationHashbangUrl(appBase, hashPrefix) {
11475
11553
  *
11476
11554
  * @constructor
11477
11555
  * @param {string} appBase application base URL
11556
+ * @param {string} appBaseNoFile application base URL stripped of any filename
11478
11557
  * @param {string} hashPrefix hashbang prefix
11479
11558
  */
11480
- function LocationHashbangInHtml5Url(appBase, hashPrefix) {
11559
+ function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
11481
11560
  this.$$html5 = true;
11482
11561
  LocationHashbangUrl.apply(this, arguments);
11483
11562
 
11484
- var appBaseNoFile = stripFile(appBase);
11485
-
11486
11563
  this.$$parseLinkUrl = function(url, relHref) {
11487
11564
  if (relHref && relHref[0] === '#') {
11488
11565
  // special case for links to hash fragments:
@@ -11512,7 +11589,7 @@ function LocationHashbangInHtml5Url(appBase, hashPrefix) {
11512
11589
  hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
11513
11590
 
11514
11591
  this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
11515
- // include hashPrefix in $$absUrl when $$url is empty so IE8 & 9 do not reload page because of removal of '#'
11592
+ // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#'
11516
11593
  this.$$absUrl = appBase + hashPrefix + this.$$url;
11517
11594
  };
11518
11595
 
@@ -12021,7 +12098,9 @@ function $LocationProvider() {
12021
12098
  appBase = stripHash(initialUrl);
12022
12099
  LocationMode = LocationHashbangUrl;
12023
12100
  }
12024
- $location = new LocationMode(appBase, '#' + hashPrefix);
12101
+ var appBaseNoFile = stripFile(appBase);
12102
+
12103
+ $location = new LocationMode(appBase, appBaseNoFile, '#' + hashPrefix);
12025
12104
  $location.$$parseLinkUrl(initialUrl, initialUrl);
12026
12105
 
12027
12106
  $location.$$state = $browser.state();
@@ -12101,6 +12180,13 @@ function $LocationProvider() {
12101
12180
 
12102
12181
  // update $location when $browser url changes
12103
12182
  $browser.onUrlChange(function(newUrl, newState) {
12183
+
12184
+ if (isUndefined(beginsWith(appBaseNoFile, newUrl))) {
12185
+ // If we are navigating outside of the app then force a reload
12186
+ $window.location.href = newUrl;
12187
+ return;
12188
+ }
12189
+
12104
12190
  $rootScope.$evalAsync(function() {
12105
12191
  var oldUrl = $location.absUrl();
12106
12192
  var oldState = $location.$$state;
@@ -13950,29 +14036,6 @@ Parser.prototype = {
13950
14036
  }
13951
14037
  };
13952
14038
 
13953
- //////////////////////////////////////////////////
13954
- // Parser helper functions
13955
- //////////////////////////////////////////////////
13956
-
13957
- function setter(obj, path, setValue, fullExp) {
13958
- ensureSafeObject(obj, fullExp);
13959
-
13960
- var element = path.split('.'), key;
13961
- for (var i = 0; element.length > 1; i++) {
13962
- key = ensureSafeMemberName(element.shift(), fullExp);
13963
- var propertyObj = ensureSafeObject(obj[key], fullExp);
13964
- if (!propertyObj) {
13965
- propertyObj = {};
13966
- obj[key] = propertyObj;
13967
- }
13968
- obj = propertyObj;
13969
- }
13970
- key = ensureSafeMemberName(element.shift(), fullExp);
13971
- ensureSafeObject(obj[key], fullExp);
13972
- obj[key] = setValue;
13973
- return setValue;
13974
- }
13975
-
13976
14039
  var getterFnCacheDefault = createMap();
13977
14040
  var getterFnCacheExpensive = createMap();
13978
14041
 
@@ -14041,13 +14104,14 @@ function $ParseProvider() {
14041
14104
  var cacheDefault = createMap();
14042
14105
  var cacheExpensive = createMap();
14043
14106
 
14044
- this.$get = ['$filter', '$sniffer', function($filter, $sniffer) {
14107
+ this.$get = ['$filter', function($filter) {
14108
+ var noUnsafeEval = csp().noUnsafeEval;
14045
14109
  var $parseOptions = {
14046
- csp: $sniffer.csp,
14110
+ csp: noUnsafeEval,
14047
14111
  expensiveChecks: false
14048
14112
  },
14049
14113
  $parseOptionsExpensive = {
14050
- csp: $sniffer.csp,
14114
+ csp: noUnsafeEval,
14051
14115
  expensiveChecks: true
14052
14116
  };
14053
14117
 
@@ -14522,8 +14586,11 @@ function qFactory(nextTick, exceptionHandler) {
14522
14586
  this.$$state = { status: 0 };
14523
14587
  }
14524
14588
 
14525
- Promise.prototype = {
14589
+ extend(Promise.prototype, {
14526
14590
  then: function(onFulfilled, onRejected, progressBack) {
14591
+ if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) {
14592
+ return this;
14593
+ }
14527
14594
  var result = new Deferred();
14528
14595
 
14529
14596
  this.$$state.pending = this.$$state.pending || [];
@@ -14544,7 +14611,7 @@ function qFactory(nextTick, exceptionHandler) {
14544
14611
  return handleCallback(error, false, callback);
14545
14612
  }, progressBack);
14546
14613
  }
14547
- };
14614
+ });
14548
14615
 
14549
14616
  //Faster, more basic than angular.bind http://jsperf.com/angular-bind-vs-custom-vs-native
14550
14617
  function simpleBind(context, fn) {
@@ -14591,7 +14658,7 @@ function qFactory(nextTick, exceptionHandler) {
14591
14658
  this.notify = simpleBind(this, this.notify);
14592
14659
  }
14593
14660
 
14594
- Deferred.prototype = {
14661
+ extend(Deferred.prototype, {
14595
14662
  resolve: function(val) {
14596
14663
  if (this.promise.$$state.status) return;
14597
14664
  if (val === this.promise) {
@@ -14654,7 +14721,7 @@ function qFactory(nextTick, exceptionHandler) {
14654
14721
  });
14655
14722
  }
14656
14723
  }
14657
- };
14724
+ });
14658
14725
 
14659
14726
  /**
14660
14727
  * @ngdoc method
@@ -14737,6 +14804,9 @@ function qFactory(nextTick, exceptionHandler) {
14737
14804
  * the promise comes from a source that can't be trusted.
14738
14805
  *
14739
14806
  * @param {*} value Value or a promise
14807
+ * @param {Function=} successCallback
14808
+ * @param {Function=} errorCallback
14809
+ * @param {Function=} progressCallback
14740
14810
  * @returns {Promise} Returns a promise of the passed value or promise
14741
14811
  */
14742
14812
 
@@ -14756,6 +14826,9 @@ function qFactory(nextTick, exceptionHandler) {
14756
14826
  * Alias of {@link ng.$q#when when} to maintain naming consistency with ES6.
14757
14827
  *
14758
14828
  * @param {*} value Value or a promise
14829
+ * @param {Function=} successCallback
14830
+ * @param {Function=} errorCallback
14831
+ * @param {Function=} progressCallback
14759
14832
  * @returns {Promise} Returns a promise of the passed value or promise
14760
14833
  */
14761
14834
  var resolve = when;
@@ -15011,12 +15084,9 @@ function $RootScopeProvider() {
15011
15084
  * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the
15012
15085
  * {@link auto.$injector $injector}. Child scopes are created using the
15013
15086
  * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when
15014
- * compiled HTML template is executed.)
15087
+ * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for
15088
+ * an in-depth introduction and usage examples.
15015
15089
  *
15016
- * Here is a simple scope snippet to show how you can interact with the scope.
15017
- * ```html
15018
- * <file src="./test/ng/rootScopeSpec.js" tag="docs1" />
15019
- * ```
15020
15090
  *
15021
15091
  * # Inheritance
15022
15092
  * A scope can inherit from a parent scope, as in this example:
@@ -15178,9 +15248,9 @@ function $RootScopeProvider() {
15178
15248
  *
15179
15249
  *
15180
15250
  * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,
15181
- * you can register a `watchExpression` function with no `listener`. (Since `watchExpression`
15182
- * can execute multiple times per {@link ng.$rootScope.Scope#$digest $digest} cycle when a
15183
- * change is detected, be prepared for multiple calls to your listener.)
15251
+ * you can register a `watchExpression` function with no `listener`. (Be prepared for
15252
+ * multiple calls to your `watchExpression` because it will execute multiple times in a
15253
+ * single {@link ng.$rootScope.Scope#$digest $digest} cycle if a change is detected.)
15184
15254
  *
15185
15255
  * After a watcher is registered with the scope, the `listener` fn is called asynchronously
15186
15256
  * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the
@@ -15942,11 +16012,14 @@ function $RootScopeProvider() {
15942
16012
  $apply: function(expr) {
15943
16013
  try {
15944
16014
  beginPhase('$apply');
15945
- return this.$eval(expr);
16015
+ try {
16016
+ return this.$eval(expr);
16017
+ } finally {
16018
+ clearPhase();
16019
+ }
15946
16020
  } catch (e) {
15947
16021
  $exceptionHandler(e);
15948
16022
  } finally {
15949
- clearPhase();
15950
16023
  try {
15951
16024
  $rootScope.$digest();
15952
16025
  } catch (e) {
@@ -16862,10 +16935,10 @@ function $SceDelegateProvider() {
16862
16935
  * - There are exactly **two wildcard sequences** - `*` and `**`. All other characters
16863
16936
  * match themselves.
16864
16937
  * - `*`: matches zero or more occurrences of any character other than one of the following 6
16865
- * characters: '`:`', '`/`', '`.`', '`?`', '`&`' and ';'. It's a useful wildcard for use
16938
+ * characters: '`:`', '`/`', '`.`', '`?`', '`&`' and '`;`'. It's a useful wildcard for use
16866
16939
  * in a whitelist.
16867
16940
  * - `**`: matches zero or more occurrences of *any* character. As such, it's not
16868
- * not appropriate to use in for a scheme, domain, etc. as it would match too much. (e.g.
16941
+ * appropriate for use in a scheme, domain, etc. as it would match too much. (e.g.
16869
16942
  * http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might
16870
16943
  * not have been the intention.) Its usage at the very end of the path is ok. (e.g.
16871
16944
  * http://foo.example.com/templates/**).
@@ -16873,11 +16946,11 @@ function $SceDelegateProvider() {
16873
16946
  * - *Caveat*: While regular expressions are powerful and offer great flexibility, their syntax
16874
16947
  * (and all the inevitable escaping) makes them *harder to maintain*. It's easy to
16875
16948
  * accidentally introduce a bug when one updates a complex expression (imho, all regexes should
16876
- * have good test coverage.). For instance, the use of `.` in the regex is correct only in a
16949
+ * have good test coverage). For instance, the use of `.` in the regex is correct only in a
16877
16950
  * small number of cases. A `.` character in the regex used when matching the scheme or a
16878
16951
  * subdomain could be matched against a `:` or literal `.` that was likely not intended. It
16879
16952
  * is highly recommended to use the string patterns and only fall back to regular expressions
16880
- * if they as a last resort.
16953
+ * as a last resort.
16881
16954
  * - The regular expression must be an instance of RegExp (i.e. not a string.) It is
16882
16955
  * matched against the **entire** *normalized / absolute URL* of the resource being tested
16883
16956
  * (even when the RegExp did not have the `^` and `$` codes.) In addition, any flags
@@ -16887,7 +16960,7 @@ function $SceDelegateProvider() {
16887
16960
  * remember to escape your regular expression (and be aware that you might need more than
16888
16961
  * one level of escaping depending on your templating engine and the way you interpolated
16889
16962
  * the value.) Do make use of your platform's escaping mechanism as it might be good
16890
- * enough before coding your own. e.g. Ruby has
16963
+ * enough before coding your own. E.g. Ruby has
16891
16964
  * [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape)
16892
16965
  * and Python has [re.escape](http://docs.python.org/library/re.html#re.escape).
16893
16966
  * Javascript lacks a similar built in function for escaping. Take a look at Google
@@ -17775,20 +17848,13 @@ var originUrl = urlResolve(window.location.href);
17775
17848
  *
17776
17849
  * Implementation Notes for IE
17777
17850
  * ---------------------------
17778
- * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other
17851
+ * IE <= 10 normalizes the URL when assigned to the anchor node similar to the other
17779
17852
  * browsers. However, the parsed components will not be set if the URL assigned did not specify
17780
17853
  * them. (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.) We
17781
17854
  * work around that by performing the parsing in a 2nd step by taking a previously normalized
17782
17855
  * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the
17783
17856
  * properties such as protocol, hostname, port, etc.
17784
17857
  *
17785
- * IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one
17786
- * uses the inner HTML approach to assign the URL as part of an HTML snippet -
17787
- * http://stackoverflow.com/a/472729) However, setting img[src] does normalize the URL.
17788
- * Unfortunately, setting img[src] to something like "javascript:foo" on IE throws an exception.
17789
- * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that
17790
- * method and IE < 8 is unsupported.
17791
- *
17792
17858
  * References:
17793
17859
  * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement
17794
17860
  * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
@@ -18068,6 +18134,7 @@ function $FilterProvider($provide) {
18068
18134
  * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
18069
18135
  * (`myapp_subsection_filterx`).
18070
18136
  * </div>
18137
+ * @param {Function} factory If the first argument was a string, a factory function for the filter to be registered.
18071
18138
  * @returns {Object} Registered filter instance, or if a map of filters was provided then a map
18072
18139
  * of the registered filter instances.
18073
18140
  */
@@ -18415,9 +18482,9 @@ function getTypeForFilter(val) {
18415
18482
  }
18416
18483
  element(by.model('amount')).clear();
18417
18484
  element(by.model('amount')).sendKeys('-1234');
18418
- expect(element(by.id('currency-default')).getText()).toBe('($1,234.00)');
18419
- expect(element(by.id('currency-custom')).getText()).toBe('(USD$1,234.00)');
18420
- expect(element(by.id('currency-no-fractions')).getText()).toBe('(USD$1,234)');
18485
+ expect(element(by.id('currency-default')).getText()).toBe('-$1,234.00');
18486
+ expect(element(by.id('currency-custom')).getText()).toBe('-USD$1,234.00');
18487
+ expect(element(by.id('currency-no-fractions')).getText()).toBe('-USD$1,234');
18421
18488
  });
18422
18489
  </file>
18423
18490
  </example>
@@ -19257,6 +19324,10 @@ function orderByFilter($parse) {
19257
19324
  if (sortPredicate.length === 0) { sortPredicate = ['+']; }
19258
19325
 
19259
19326
  var predicates = processPredicates(sortPredicate, reverseOrder);
19327
+ // Add a predicate at the end that evaluates to the element index. This makes the
19328
+ // sort stable as it works as a tie-breaker when all the input predicates cannot
19329
+ // distinguish between two elements.
19330
+ predicates.push({ get: function() { return {}; }, descending: reverseOrder ? -1 : 1});
19260
19331
 
19261
19332
  // The next three lines are a version of a Swartzian Transform idiom from Perl
19262
19333
  // (sometimes called the Decorate-Sort-Undecorate idiom)
@@ -20302,7 +20373,7 @@ function FormController(element, attrs, $scope, $animate, $interpolate) {
20302
20373
  * related scope, under this name.
20303
20374
  */
20304
20375
  var formDirectiveFactory = function(isNgForm) {
20305
- return ['$timeout', function($timeout) {
20376
+ return ['$timeout', '$parse', function($timeout, $parse) {
20306
20377
  var formDirective = {
20307
20378
  name: 'form',
20308
20379
  restrict: isNgForm ? 'EAC' : 'E',
@@ -20344,21 +20415,21 @@ var formDirectiveFactory = function(isNgForm) {
20344
20415
  }
20345
20416
 
20346
20417
  var parentFormCtrl = controller.$$parentForm;
20418
+ var setter = nameAttr ? getSetter(controller.$name) : noop;
20347
20419
 
20348
20420
  if (nameAttr) {
20349
- setter(scope, controller.$name, controller, controller.$name);
20421
+ setter(scope, controller);
20350
20422
  attr.$observe(nameAttr, function(newValue) {
20351
20423
  if (controller.$name === newValue) return;
20352
- setter(scope, controller.$name, undefined, controller.$name);
20424
+ setter(scope, undefined);
20353
20425
  parentFormCtrl.$$renameControl(controller, newValue);
20354
- setter(scope, controller.$name, controller, controller.$name);
20426
+ setter = getSetter(controller.$name);
20427
+ setter(scope, controller);
20355
20428
  });
20356
20429
  }
20357
20430
  formElement.on('$destroy', function() {
20358
20431
  parentFormCtrl.$removeControl(controller);
20359
- if (nameAttr) {
20360
- setter(scope, attr[nameAttr], undefined, controller.$name);
20361
- }
20432
+ setter(scope, undefined);
20362
20433
  extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
20363
20434
  });
20364
20435
  }
@@ -20367,6 +20438,14 @@ var formDirectiveFactory = function(isNgForm) {
20367
20438
  };
20368
20439
 
20369
20440
  return formDirective;
20441
+
20442
+ function getSetter(expression) {
20443
+ if (expression === '') {
20444
+ //create an assignable expression, so forms with an empty name can be renamed later
20445
+ return $parse('this[""]').assign;
20446
+ }
20447
+ return $parse(expression).assign || noop;
20448
+ }
20370
20449
  }];
20371
20450
  };
20372
20451
 
@@ -20379,7 +20458,7 @@ var ngFormDirective = formDirectiveFactory(true);
20379
20458
  DIRTY_CLASS: false,
20380
20459
  UNTOUCHED_CLASS: false,
20381
20460
  TOUCHED_CLASS: false,
20382
- $ngModelMinErr: false,
20461
+ ngModelMinErr: false,
20383
20462
  */
20384
20463
 
20385
20464
  // Regex code is obtained from SO: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231
@@ -21501,7 +21580,11 @@ function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
21501
21580
  element.on('change', listener);
21502
21581
 
21503
21582
  ctrl.$render = function() {
21504
- element.val(ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue);
21583
+ // Workaround for Firefox validation #12102.
21584
+ var value = ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue;
21585
+ if (element.val() !== value) {
21586
+ element.val(value);
21587
+ }
21505
21588
  };
21506
21589
  }
21507
21590
 
@@ -21612,7 +21695,7 @@ function createDateInputType(type, regexp, parseDate, format) {
21612
21695
 
21613
21696
  ctrl.$formatters.push(function(value) {
21614
21697
  if (value && !isDate(value)) {
21615
- throw $ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value);
21698
+ throw ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value);
21616
21699
  }
21617
21700
  if (isValidDate(value)) {
21618
21701
  previousDate = value;
@@ -21688,7 +21771,7 @@ function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
21688
21771
  ctrl.$formatters.push(function(value) {
21689
21772
  if (!ctrl.$isEmpty(value)) {
21690
21773
  if (!isNumber(value)) {
21691
- throw $ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value);
21774
+ throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value);
21692
21775
  }
21693
21776
  value = value.toString();
21694
21777
  }
@@ -21781,7 +21864,7 @@ function parseConstantExpr($parse, context, name, expression, fallback) {
21781
21864
  if (isDefined(expression)) {
21782
21865
  parseFn = $parse(expression);
21783
21866
  if (!parseFn.constant) {
21784
- throw minErr('ngModel')('constexpr', 'Expected constant expression for `{0}`, but saw ' +
21867
+ throw ngModelMinErr('constexpr', 'Expected constant expression for `{0}`, but saw ' +
21785
21868
  '`{1}`.', name, expression);
21786
21869
  }
21787
21870
  return parseFn(context);
@@ -23067,27 +23150,29 @@ var ngControllerDirective = [function() {
23067
23150
  *
23068
23151
  * @element html
23069
23152
  * @description
23070
- * Enables [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) support.
23153
+ *
23154
+ * Angular has some features that can break certain
23155
+ * [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) rules.
23156
+ *
23157
+ * If you intend to implement these rules then you must tell Angular not to use these features.
23071
23158
  *
23072
23159
  * This is necessary when developing things like Google Chrome Extensions or Universal Windows Apps.
23073
23160
  *
23074
- * CSP forbids apps to use `eval` or `Function(string)` generated functions (among other things).
23075
- * For Angular to be CSP compatible there are only two things that we need to do differently:
23076
23161
  *
23077
- * - don't use `Function` constructor to generate optimized value getters
23078
- * - don't inject custom stylesheet into the document
23162
+ * The following rules affect Angular:
23079
23163
  *
23080
- * AngularJS uses `Function(string)` generated functions as a speed optimization. Applying the `ngCsp`
23081
- * directive will cause Angular to use CSP compatibility mode. When this mode is on AngularJS will
23082
- * evaluate all expressions up to 30% slower than in non-CSP mode, but no security violations will
23083
- * be raised.
23164
+ * * `unsafe-eval`: this rule forbids apps to use `eval` or `Function(string)` generated functions
23165
+ * (among other things). Angular makes use of this in the {@link $parse} service to provide a 30%
23166
+ * increase in the speed of evaluating Angular expressions.
23084
23167
  *
23085
- * CSP forbids JavaScript to inline stylesheet rules. In non CSP mode Angular automatically
23086
- * includes some CSS rules (e.g. {@link ng.directive:ngCloak ngCloak}).
23087
- * To make those directives work in CSP mode, include the `angular-csp.css` manually.
23168
+ * * `unsafe-inline`: this rule forbids apps from inject custom styles into the document. Angular
23169
+ * makes use of this to include some CSS rules (e.g. {@link ngCloak} and {@link ngHide}).
23170
+ * To make these directives work when a CSP rule is blocking inline styles, you must link to the
23171
+ * `angular-csp.css` in your HTML manually.
23088
23172
  *
23089
- * Angular tries to autodetect if CSP is active and automatically turn on the CSP-safe mode. This
23090
- * autodetection however triggers a CSP error to be logged in the console:
23173
+ * If you do not provide `ngCsp` then Angular tries to autodetect if CSP is blocking unsafe-eval
23174
+ * and automatically deactivates this feature in the {@link $parse} service. This autodetection,
23175
+ * however, triggers a CSP error to be logged in the console:
23091
23176
  *
23092
23177
  * ```
23093
23178
  * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of
@@ -23096,11 +23181,39 @@ var ngControllerDirective = [function() {
23096
23181
  * ```
23097
23182
  *
23098
23183
  * This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`
23099
- * directive on the root element of the application or on the `angular.js` script tag, whichever
23100
- * appears first in the html document.
23184
+ * directive on an element of the HTML document that appears before the `<script>` tag that loads
23185
+ * the `angular.js` file.
23101
23186
  *
23102
23187
  * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*
23103
23188
  *
23189
+ * You can specify which of the CSP related Angular features should be deactivated by providing
23190
+ * a value for the `ng-csp` attribute. The options are as follows:
23191
+ *
23192
+ * * no-inline-style: this stops Angular from injecting CSS styles into the DOM
23193
+ *
23194
+ * * no-unsafe-eval: this stops Angular from optimising $parse with unsafe eval of strings
23195
+ *
23196
+ * You can use these values in the following combinations:
23197
+ *
23198
+ *
23199
+ * * No declaration means that Angular will assume that you can do inline styles, but it will do
23200
+ * a runtime check for unsafe-eval. E.g. `<body>`. This is backwardly compatible with previous versions
23201
+ * of Angular.
23202
+ *
23203
+ * * A simple `ng-csp` (or `data-ng-csp`) attribute will tell Angular to deactivate both inline
23204
+ * styles and unsafe eval. E.g. `<body ng-csp>`. This is backwardly compatible with previous versions
23205
+ * of Angular.
23206
+ *
23207
+ * * Specifying only `no-unsafe-eval` tells Angular that we must not use eval, but that we can inject
23208
+ * inline styles. E.g. `<body ng-csp="no-unsafe-eval">`.
23209
+ *
23210
+ * * Specifying only `no-inline-style` tells Angular that we must not inject styles, but that we can
23211
+ * run eval - no automcatic check for unsafe eval will occur. E.g. `<body ng-csp="no-inline-style">`
23212
+ *
23213
+ * * Specifying both `no-unsafe-eval` and `no-inline-style` tells Angular that we must not inject
23214
+ * styles nor use eval, which is the same as an empty: ng-csp.
23215
+ * E.g.`<body ng-csp="no-inline-style;no-unsafe-eval">`
23216
+ *
23104
23217
  * @example
23105
23218
  * This example shows how to apply the `ngCsp` directive to the `html` tag.
23106
23219
  ```html
@@ -23232,7 +23345,7 @@ var ngControllerDirective = [function() {
23232
23345
 
23233
23346
  // ngCsp is not implemented as a proper directive any more, because we need it be processed while we
23234
23347
  // bootstrap the system (before $parse is instantiated), for this reason we just have
23235
- // the csp.isActive() fn that looks for ng-csp attribute anywhere in the current doc
23348
+ // the csp() fn that looks for the `ng-csp` attribute anywhere in the current doc
23236
23349
 
23237
23350
  /**
23238
23351
  * @ngdoc directive
@@ -24348,8 +24461,7 @@ var VALID_CLASS = 'ng-valid',
24348
24461
  TOUCHED_CLASS = 'ng-touched',
24349
24462
  PENDING_CLASS = 'ng-pending';
24350
24463
 
24351
-
24352
- var $ngModelMinErr = new minErr('ngModel');
24464
+ var ngModelMinErr = minErr('ngModel');
24353
24465
 
24354
24466
  /**
24355
24467
  * @ngdoc type
@@ -24600,7 +24712,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
24600
24712
  }
24601
24713
  };
24602
24714
  } else if (!parsedNgModel.assign) {
24603
- throw $ngModelMinErr('nonassign', "Expression '{0}' is non-assignable. Element: {1}",
24715
+ throw ngModelMinErr('nonassign', "Expression '{0}' is non-assignable. Element: {1}",
24604
24716
  $attr.ngModel, startingTag($element));
24605
24717
  }
24606
24718
  };
@@ -24931,7 +25043,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
24931
25043
  forEach(ctrl.$asyncValidators, function(validator, name) {
24932
25044
  var promise = validator(modelValue, viewValue);
24933
25045
  if (!isPromiseLike(promise)) {
24934
- throw $ngModelMinErr("$asyncValidators",
25046
+ throw ngModelMinErr("$asyncValidators",
24935
25047
  "Expected asynchronous validator to return a promise but got '{0}' instead.", promise);
24936
25048
  }
24937
25049
  setValidity(name, undefined);
@@ -25785,7 +25897,7 @@ var ngOptionsMinErr = minErr('ngOptions');
25785
25897
  * Consider the following example:
25786
25898
  *
25787
25899
  * ```html
25788
- * <select ng-options="item.subItem as item.label for item in values track by item.id" ng-model="selected">
25900
+ * <select ng-options="item.subItem as item.label for item in values track by item.id" ng-model="selected"></select>
25789
25901
  * ```
25790
25902
  *
25791
25903
  * ```js
@@ -26247,7 +26359,7 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
26247
26359
 
26248
26360
  forEach(selectedValues, function(value) {
26249
26361
  var option = options.selectValueMap[value];
26250
- if (!option.disabled) selections.push(options.getViewValueFromOption(option));
26362
+ if (option && !option.disabled) selections.push(options.getViewValueFromOption(option));
26251
26363
  });
26252
26364
 
26253
26365
  return selections;
@@ -28343,17 +28455,145 @@ var minlengthDirective = function() {
28343
28455
  };
28344
28456
  };
28345
28457
 
28346
- if (window.angular.bootstrap) {
28347
- //AngularJS is already loaded, so we can return here...
28348
- console.log('WARNING: Tried to load angular more than once.');
28349
- return;
28458
+ if (window.angular.bootstrap) {
28459
+ //AngularJS is already loaded, so we can return here...
28460
+ console.log('WARNING: Tried to load angular more than once.');
28461
+ return;
28462
+ }
28463
+
28464
+ //try to bind to jquery now so that one can write jqLite(document).ready()
28465
+ //but we will rebind on bootstrap again.
28466
+ bindJQuery();
28467
+
28468
+ publishExternalAPI(angular);
28469
+
28470
+ angular.module("ngLocale", [], ["$provide", function($provide) {
28471
+ var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
28472
+ function getDecimals(n) {
28473
+ n = n + '';
28474
+ var i = n.indexOf('.');
28475
+ return (i == -1) ? 0 : n.length - i - 1;
28476
+ }
28477
+
28478
+ function getVF(n, opt_precision) {
28479
+ var v = opt_precision;
28480
+
28481
+ if (undefined === v) {
28482
+ v = Math.min(getDecimals(n), 3);
28350
28483
  }
28351
28484
 
28352
- //try to bind to jquery now so that one can write jqLite(document).ready()
28353
- //but we will rebind on bootstrap again.
28354
- bindJQuery();
28485
+ var base = Math.pow(10, v);
28486
+ var f = ((n * base) | 0) % base;
28487
+ return {v: v, f: f};
28488
+ }
28355
28489
 
28356
- publishExternalAPI(angular);
28490
+ $provide.value("$locale", {
28491
+ "DATETIME_FORMATS": {
28492
+ "AMPMS": [
28493
+ "AM",
28494
+ "PM"
28495
+ ],
28496
+ "DAY": [
28497
+ "Sunday",
28498
+ "Monday",
28499
+ "Tuesday",
28500
+ "Wednesday",
28501
+ "Thursday",
28502
+ "Friday",
28503
+ "Saturday"
28504
+ ],
28505
+ "ERANAMES": [
28506
+ "Before Christ",
28507
+ "Anno Domini"
28508
+ ],
28509
+ "ERAS": [
28510
+ "BC",
28511
+ "AD"
28512
+ ],
28513
+ "FIRSTDAYOFWEEK": 6,
28514
+ "MONTH": [
28515
+ "January",
28516
+ "February",
28517
+ "March",
28518
+ "April",
28519
+ "May",
28520
+ "June",
28521
+ "July",
28522
+ "August",
28523
+ "September",
28524
+ "October",
28525
+ "November",
28526
+ "December"
28527
+ ],
28528
+ "SHORTDAY": [
28529
+ "Sun",
28530
+ "Mon",
28531
+ "Tue",
28532
+ "Wed",
28533
+ "Thu",
28534
+ "Fri",
28535
+ "Sat"
28536
+ ],
28537
+ "SHORTMONTH": [
28538
+ "Jan",
28539
+ "Feb",
28540
+ "Mar",
28541
+ "Apr",
28542
+ "May",
28543
+ "Jun",
28544
+ "Jul",
28545
+ "Aug",
28546
+ "Sep",
28547
+ "Oct",
28548
+ "Nov",
28549
+ "Dec"
28550
+ ],
28551
+ "WEEKENDRANGE": [
28552
+ 5,
28553
+ 6
28554
+ ],
28555
+ "fullDate": "EEEE, MMMM d, y",
28556
+ "longDate": "MMMM d, y",
28557
+ "medium": "MMM d, y h:mm:ss a",
28558
+ "mediumDate": "MMM d, y",
28559
+ "mediumTime": "h:mm:ss a",
28560
+ "short": "M/d/yy h:mm a",
28561
+ "shortDate": "M/d/yy",
28562
+ "shortTime": "h:mm a"
28563
+ },
28564
+ "NUMBER_FORMATS": {
28565
+ "CURRENCY_SYM": "$",
28566
+ "DECIMAL_SEP": ".",
28567
+ "GROUP_SEP": ",",
28568
+ "PATTERNS": [
28569
+ {
28570
+ "gSize": 3,
28571
+ "lgSize": 3,
28572
+ "maxFrac": 3,
28573
+ "minFrac": 0,
28574
+ "minInt": 1,
28575
+ "negPre": "-",
28576
+ "negSuf": "",
28577
+ "posPre": "",
28578
+ "posSuf": ""
28579
+ },
28580
+ {
28581
+ "gSize": 3,
28582
+ "lgSize": 3,
28583
+ "maxFrac": 2,
28584
+ "minFrac": 2,
28585
+ "minInt": 1,
28586
+ "negPre": "-\u00a4",
28587
+ "negSuf": "",
28588
+ "posPre": "\u00a4",
28589
+ "posSuf": ""
28590
+ }
28591
+ ]
28592
+ },
28593
+ "id": "en-us",
28594
+ "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
28595
+ });
28596
+ }]);
28357
28597
 
28358
28598
  jqLite(document).ready(function() {
28359
28599
  angularInit(document, bootstrap);
@@ -28361,4 +28601,4 @@ var minlengthDirective = function() {
28361
28601
 
28362
28602
  })(window, document);
28363
28603
 
28364
- !window.angular.$$csp() && window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');
28604
+ !window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');