angularjs-rails 1.6.1 → 1.6.2

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,6 +1,6 @@
1
1
  /**
2
- * @license AngularJS v1.6.1
3
- * (c) 2010-2016 Google, Inc. http://angularjs.org
2
+ * @license AngularJS v1.6.2
3
+ * (c) 2010-2017 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
6
  (function(window, angular) {'use strict';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license AngularJS v1.6.1
3
- * (c) 2010-2016 Google, Inc. http://angularjs.org
2
+ * @license AngularJS v1.6.2
3
+ * (c) 2010-2017 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
6
  (function(window) {'use strict';
@@ -57,7 +57,7 @@ function minErr(module, ErrorConstructor) {
57
57
  return match;
58
58
  });
59
59
 
60
- message += '\nhttp://errors.angularjs.org/1.6.1/' +
60
+ message += '\nhttp://errors.angularjs.org/1.6.2/' +
61
61
  (module ? module + '/' : '') + code;
62
62
 
63
63
  for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
@@ -1548,12 +1548,16 @@ function getNgAttribute(element, ngAttr) {
1548
1548
  }
1549
1549
 
1550
1550
  function allowAutoBootstrap(document) {
1551
- if (!document.currentScript) {
1551
+ var script = document.currentScript;
1552
+ var src = script && script.getAttribute('src');
1553
+
1554
+ if (!src) {
1552
1555
  return true;
1553
1556
  }
1554
- var src = document.currentScript.getAttribute('src');
1557
+
1555
1558
  var link = document.createElement('a');
1556
1559
  link.href = src;
1560
+
1557
1561
  if (document.location.origin === link.origin) {
1558
1562
  // Same-origin resources are always allowed, even for non-whitelisted schemes.
1559
1563
  return true;
@@ -1935,7 +1939,7 @@ function bindJQuery() {
1935
1939
  extend(jQuery.fn, {
1936
1940
  scope: JQLitePrototype.scope,
1937
1941
  isolateScope: JQLitePrototype.isolateScope,
1938
- controller: JQLitePrototype.controller,
1942
+ controller: /** @type {?} */ (JQLitePrototype).controller,
1939
1943
  injector: JQLitePrototype.injector,
1940
1944
  inheritedData: JQLitePrototype.inheritedData
1941
1945
  });
@@ -2577,7 +2581,6 @@ function toDebugString(obj) {
2577
2581
  $$ForceReflowProvider,
2578
2582
  $InterpolateProvider,
2579
2583
  $IntervalProvider,
2580
- $$HashMapProvider,
2581
2584
  $HttpProvider,
2582
2585
  $HttpParamSerializerProvider,
2583
2586
  $HttpParamSerializerJQLikeProvider,
@@ -2586,6 +2589,7 @@ function toDebugString(obj) {
2586
2589
  $jsonpCallbacksProvider,
2587
2590
  $LocationProvider,
2588
2591
  $LogProvider,
2592
+ $$MapProvider,
2589
2593
  $ParseProvider,
2590
2594
  $RootScopeProvider,
2591
2595
  $QProvider,
@@ -2623,11 +2627,11 @@ function toDebugString(obj) {
2623
2627
  var version = {
2624
2628
  // These placeholder strings will be replaced by grunt's `build` task.
2625
2629
  // They need to be double- or single-quoted.
2626
- full: '1.6.1',
2630
+ full: '1.6.2',
2627
2631
  major: 1,
2628
2632
  minor: 6,
2629
- dot: 1,
2630
- codeName: 'promise-rectification'
2633
+ dot: 2,
2634
+ codeName: 'llamacorn-lovehug'
2631
2635
  };
2632
2636
 
2633
2637
 
@@ -2767,7 +2771,7 @@ function publishExternalAPI(angular) {
2767
2771
  $window: $WindowProvider,
2768
2772
  $$rAF: $$RAFProvider,
2769
2773
  $$jqLite: $$jqLiteProvider,
2770
- $$HashMap: $$HashMapProvider,
2774
+ $$Map: $$MapProvider,
2771
2775
  $$cookieReader: $$CookieReaderProvider
2772
2776
  });
2773
2777
  }
@@ -3915,50 +3919,70 @@ function hashKey(obj, nextUidFn) {
3915
3919
  return key;
3916
3920
  }
3917
3921
 
3918
- /**
3919
- * HashMap which can use objects as keys
3920
- */
3921
- function HashMap(array, isolatedUid) {
3922
- if (isolatedUid) {
3923
- var uid = 0;
3924
- this.nextUid = function() {
3925
- return ++uid;
3926
- };
3927
- }
3928
- forEach(array, this.put, this);
3922
+ // A minimal ES2015 Map implementation.
3923
+ // Should be bug/feature equivalent to the native implementations of supported browsers
3924
+ // (for the features required in Angular).
3925
+ // See https://kangax.github.io/compat-table/es6/#test-Map
3926
+ var nanKey = Object.create(null);
3927
+ function NgMapShim() {
3928
+ this._keys = [];
3929
+ this._values = [];
3930
+ this._lastKey = NaN;
3931
+ this._lastIndex = -1;
3929
3932
  }
3930
- HashMap.prototype = {
3931
- /**
3932
- * Store key value pair
3933
- * @param key key to store can be any type
3934
- * @param value value to store can be any type
3935
- */
3936
- put: function(key, value) {
3937
- this[hashKey(key, this.nextUid)] = value;
3933
+ NgMapShim.prototype = {
3934
+ _idx: function(key) {
3935
+ if (key === this._lastKey) {
3936
+ return this._lastIndex;
3937
+ }
3938
+ this._lastKey = key;
3939
+ this._lastIndex = this._keys.indexOf(key);
3940
+ return this._lastIndex;
3941
+ },
3942
+ _transformKey: function(key) {
3943
+ return isNumberNaN(key) ? nanKey : key;
3938
3944
  },
3939
-
3940
- /**
3941
- * @param key
3942
- * @returns {Object} the value for the key
3943
- */
3944
3945
  get: function(key) {
3945
- return this[hashKey(key, this.nextUid)];
3946
+ key = this._transformKey(key);
3947
+ var idx = this._idx(key);
3948
+ if (idx !== -1) {
3949
+ return this._values[idx];
3950
+ }
3946
3951
  },
3952
+ set: function(key, value) {
3953
+ key = this._transformKey(key);
3954
+ var idx = this._idx(key);
3955
+ if (idx === -1) {
3956
+ idx = this._lastIndex = this._keys.length;
3957
+ }
3958
+ this._keys[idx] = key;
3959
+ this._values[idx] = value;
3947
3960
 
3948
- /**
3949
- * Remove the key/value pair
3950
- * @param key
3951
- */
3952
- remove: function(key) {
3953
- var value = this[key = hashKey(key, this.nextUid)];
3954
- delete this[key];
3955
- return value;
3961
+ // Support: IE11
3962
+ // Do not `return this` to simulate the partial IE11 implementation
3963
+ },
3964
+ delete: function(key) {
3965
+ key = this._transformKey(key);
3966
+ var idx = this._idx(key);
3967
+ if (idx === -1) {
3968
+ return false;
3969
+ }
3970
+ this._keys.splice(idx, 1);
3971
+ this._values.splice(idx, 1);
3972
+ this._lastKey = NaN;
3973
+ this._lastIndex = -1;
3974
+ return true;
3956
3975
  }
3957
3976
  };
3958
3977
 
3959
- var $$HashMapProvider = [/** @this */function() {
3978
+ // For now, always use `NgMapShim`, even if `window.Map` is available. Some native implementations
3979
+ // are still buggy (often in subtle ways) and can cause hard-to-debug failures. When native `Map`
3980
+ // implementations get more stable, we can reconsider switching to `window.Map` (when available).
3981
+ var NgMap = NgMapShim;
3982
+
3983
+ var $$MapProvider = [/** @this */function() {
3960
3984
  this.$get = [function() {
3961
- return HashMap;
3985
+ return NgMap;
3962
3986
  }];
3963
3987
  }];
3964
3988
 
@@ -4033,11 +4057,7 @@ var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
4033
4057
  var $injectorMinErr = minErr('$injector');
4034
4058
 
4035
4059
  function stringifyFn(fn) {
4036
- // Support: Chrome 50-51 only
4037
- // Creating a new string by adding `' '` at the end, to hack around some bug in Chrome v50/51
4038
- // (See https://github.com/angular/angular.js/issues/14487.)
4039
- // TODO (gkalpak): Remove workaround when Chrome v52 is released
4040
- return Function.prototype.toString.call(fn) + ' ';
4060
+ return Function.prototype.toString.call(fn);
4041
4061
  }
4042
4062
 
4043
4063
  function extractArgs(fn) {
@@ -4611,7 +4631,7 @@ function createInjector(modulesToLoad, strictDi) {
4611
4631
  var INSTANTIATING = {},
4612
4632
  providerSuffix = 'Provider',
4613
4633
  path = [],
4614
- loadedModules = new HashMap([], true),
4634
+ loadedModules = new NgMap(),
4615
4635
  providerCache = {
4616
4636
  $provide: {
4617
4637
  provider: supportObject(provider),
@@ -4719,7 +4739,7 @@ function createInjector(modulesToLoad, strictDi) {
4719
4739
  var runBlocks = [], moduleFn;
4720
4740
  forEach(modulesToLoad, function(module) {
4721
4741
  if (loadedModules.get(module)) return;
4722
- loadedModules.put(module, true);
4742
+ loadedModules.set(module, true);
4723
4743
 
4724
4744
  function runInvokeQueue(queue) {
4725
4745
  var i, ii;
@@ -5205,7 +5225,7 @@ var $$CoreAnimateJsProvider = /** @this */ function() {
5205
5225
  // this is prefixed with Core since it conflicts with
5206
5226
  // the animateQueueProvider defined in ngAnimate/animateQueue.js
5207
5227
  var $$CoreAnimateQueueProvider = /** @this */ function() {
5208
- var postDigestQueue = new HashMap();
5228
+ var postDigestQueue = new NgMap();
5209
5229
  var postDigestElements = [];
5210
5230
 
5211
5231
  this.$get = ['$$AnimateRunner', '$rootScope',
@@ -5284,7 +5304,7 @@ var $$CoreAnimateQueueProvider = /** @this */ function() {
5284
5304
  jqLiteRemoveClass(elm, toRemove);
5285
5305
  }
5286
5306
  });
5287
- postDigestQueue.remove(element);
5307
+ postDigestQueue.delete(element);
5288
5308
  }
5289
5309
  });
5290
5310
  postDigestElements.length = 0;
@@ -5299,7 +5319,7 @@ var $$CoreAnimateQueueProvider = /** @this */ function() {
5299
5319
 
5300
5320
  if (classesAdded || classesRemoved) {
5301
5321
 
5302
- postDigestQueue.put(element, data);
5322
+ postDigestQueue.set(element, data);
5303
5323
  postDigestElements.push(element);
5304
5324
 
5305
5325
  if (postDigestElements.length === 1) {
@@ -6159,7 +6179,6 @@ function Browser(window, document, $log, $sniffer) {
6159
6179
  };
6160
6180
 
6161
6181
  cacheState();
6162
- lastHistoryState = cachedState;
6163
6182
 
6164
6183
  /**
6165
6184
  * @name $browser#url
@@ -6213,8 +6232,6 @@ function Browser(window, document, $log, $sniffer) {
6213
6232
  if ($sniffer.history && (!sameBase || !sameState)) {
6214
6233
  history[replace ? 'replaceState' : 'pushState'](state, '', url);
6215
6234
  cacheState();
6216
- // Do the assignment again so that those two variables are referentially identical.
6217
- lastHistoryState = cachedState;
6218
6235
  } else {
6219
6236
  if (!sameBase) {
6220
6237
  pendingLocation = url;
@@ -6263,8 +6280,7 @@ function Browser(window, document, $log, $sniffer) {
6263
6280
 
6264
6281
  function cacheStateAndFireUrlChange() {
6265
6282
  pendingLocation = null;
6266
- cacheState();
6267
- fireUrlChange();
6283
+ fireStateOrUrlChange();
6268
6284
  }
6269
6285
 
6270
6286
  // This variable should be used *only* inside the cacheState function.
@@ -6278,11 +6294,16 @@ function Browser(window, document, $log, $sniffer) {
6278
6294
  if (equals(cachedState, lastCachedState)) {
6279
6295
  cachedState = lastCachedState;
6280
6296
  }
6297
+
6281
6298
  lastCachedState = cachedState;
6299
+ lastHistoryState = cachedState;
6282
6300
  }
6283
6301
 
6284
- function fireUrlChange() {
6285
- if (lastBrowserUrl === self.url() && lastHistoryState === cachedState) {
6302
+ function fireStateOrUrlChange() {
6303
+ var prevLastHistoryState = lastHistoryState;
6304
+ cacheState();
6305
+
6306
+ if (lastBrowserUrl === self.url() && prevLastHistoryState === cachedState) {
6286
6307
  return;
6287
6308
  }
6288
6309
 
@@ -6348,7 +6369,7 @@ function Browser(window, document, $log, $sniffer) {
6348
6369
  * Needs to be exported to be able to check for changes that have been done in sync,
6349
6370
  * as hashchange/popstate events fire in async.
6350
6371
  */
6351
- self.$$checkUrlChange = fireUrlChange;
6372
+ self.$$checkUrlChange = fireStateOrUrlChange;
6352
6373
 
6353
6374
  //////////////////////////////////////////////////////////////
6354
6375
  // Misc API
@@ -6958,7 +6979,8 @@ function $TemplateCacheProvider() {
6958
6979
  * * `$onChanges(changesObj)` - Called whenever one-way (`<`) or interpolation (`@`) bindings are updated. The
6959
6980
  * `changesObj` is a hash whose keys are the names of the bound properties that have changed, and the values are an
6960
6981
  * object of the form `{ currentValue, previousValue, isFirstChange() }`. Use this hook to trigger updates within a
6961
- * component such as cloning the bound value to prevent accidental mutation of the outer value.
6982
+ * component such as cloning the bound value to prevent accidental mutation of the outer value. Note that this will
6983
+ * also be called when your bindings are initialized.
6962
6984
  * * `$doCheck()` - Called on each turn of the digest cycle. Provides an opportunity to detect and act on
6963
6985
  * changes. Any actions that you wish to take in response to the changes that you detect must be
6964
6986
  * invoked from this hook; implementing this has no effect on when `$onChanges` is called. For example, this hook
@@ -7813,7 +7835,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
7813
7835
  var bindingCache = createMap();
7814
7836
 
7815
7837
  function parseIsolateBindings(scope, directiveName, isController) {
7816
- var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*(\w*)\s*$/;
7838
+ var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*([\w$]*)\s*$/;
7817
7839
 
7818
7840
  var bindings = createMap();
7819
7841
 
@@ -9985,7 +10007,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
9985
10007
  if (error instanceof Error) {
9986
10008
  $exceptionHandler(error);
9987
10009
  }
9988
- }).catch(noop);
10010
+ });
9989
10011
 
9990
10012
  return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {
9991
10013
  var childBoundTranscludeFn = boundTranscludeFn;
@@ -12117,7 +12139,8 @@ function $HttpProvider() {
12117
12139
  if ((config.cache || defaults.cache) && config.cache !== false &&
12118
12140
  (config.method === 'GET' || config.method === 'JSONP')) {
12119
12141
  cache = isObject(config.cache) ? config.cache
12120
- : isObject(defaults.cache) ? defaults.cache
12142
+ : isObject(/** @type {?} */ (defaults).cache)
12143
+ ? /** @type {?} */ (defaults).cache
12121
12144
  : defaultCache;
12122
12145
  }
12123
12146
 
@@ -13295,6 +13318,8 @@ function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {
13295
13318
 
13296
13319
  this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
13297
13320
  this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/'
13321
+
13322
+ this.$$urlUpdatedByLocation = true;
13298
13323
  };
13299
13324
 
13300
13325
  this.$$parseLinkUrl = function(url, relHref) {
@@ -13372,7 +13397,7 @@ function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
13372
13397
  withoutHashUrl = '';
13373
13398
  if (isUndefined(withoutBaseUrl)) {
13374
13399
  appBase = url;
13375
- this.replace();
13400
+ /** @type {?} */ (this).replace();
13376
13401
  }
13377
13402
  }
13378
13403
  }
@@ -13428,6 +13453,8 @@ function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
13428
13453
 
13429
13454
  this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
13430
13455
  this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');
13456
+
13457
+ this.$$urlUpdatedByLocation = true;
13431
13458
  };
13432
13459
 
13433
13460
  this.$$parseLinkUrl = function(url, relHref) {
@@ -13485,6 +13512,8 @@ function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
13485
13512
  this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
13486
13513
  // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#'
13487
13514
  this.$$absUrl = appBase + hashPrefix + this.$$url;
13515
+
13516
+ this.$$urlUpdatedByLocation = true;
13488
13517
  };
13489
13518
 
13490
13519
  }
@@ -13814,6 +13843,7 @@ forEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], fun
13814
13843
  // but we're changing the $$state reference to $browser.state() during the $digest
13815
13844
  // so the modification window is narrow.
13816
13845
  this.$$state = isUndefined(state) ? null : state;
13846
+ this.$$urlUpdatedByLocation = true;
13817
13847
 
13818
13848
  return this;
13819
13849
  };
@@ -14126,36 +14156,40 @@ function $LocationProvider() {
14126
14156
 
14127
14157
  // update browser
14128
14158
  $rootScope.$watch(function $locationWatch() {
14129
- var oldUrl = trimEmptyHash($browser.url());
14130
- var newUrl = trimEmptyHash($location.absUrl());
14131
- var oldState = $browser.state();
14132
- var currentReplace = $location.$$replace;
14133
- var urlOrStateChanged = oldUrl !== newUrl ||
14134
- ($location.$$html5 && $sniffer.history && oldState !== $location.$$state);
14159
+ if (initializing || $location.$$urlUpdatedByLocation) {
14160
+ $location.$$urlUpdatedByLocation = false;
14135
14161
 
14136
- if (initializing || urlOrStateChanged) {
14137
- initializing = false;
14162
+ var oldUrl = trimEmptyHash($browser.url());
14163
+ var newUrl = trimEmptyHash($location.absUrl());
14164
+ var oldState = $browser.state();
14165
+ var currentReplace = $location.$$replace;
14166
+ var urlOrStateChanged = oldUrl !== newUrl ||
14167
+ ($location.$$html5 && $sniffer.history && oldState !== $location.$$state);
14138
14168
 
14139
- $rootScope.$evalAsync(function() {
14140
- var newUrl = $location.absUrl();
14141
- var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,
14142
- $location.$$state, oldState).defaultPrevented;
14169
+ if (initializing || urlOrStateChanged) {
14170
+ initializing = false;
14143
14171
 
14144
- // if the location was changed by a `$locationChangeStart` handler then stop
14145
- // processing this location change
14146
- if ($location.absUrl() !== newUrl) return;
14172
+ $rootScope.$evalAsync(function() {
14173
+ var newUrl = $location.absUrl();
14174
+ var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,
14175
+ $location.$$state, oldState).defaultPrevented;
14147
14176
 
14148
- if (defaultPrevented) {
14149
- $location.$$parse(oldUrl);
14150
- $location.$$state = oldState;
14151
- } else {
14152
- if (urlOrStateChanged) {
14153
- setBrowserUrlWithFallback(newUrl, currentReplace,
14154
- oldState === $location.$$state ? null : $location.$$state);
14177
+ // if the location was changed by a `$locationChangeStart` handler then stop
14178
+ // processing this location change
14179
+ if ($location.absUrl() !== newUrl) return;
14180
+
14181
+ if (defaultPrevented) {
14182
+ $location.$$parse(oldUrl);
14183
+ $location.$$state = oldState;
14184
+ } else {
14185
+ if (urlOrStateChanged) {
14186
+ setBrowserUrlWithFallback(newUrl, currentReplace,
14187
+ oldState === $location.$$state ? null : $location.$$state);
14188
+ }
14189
+ afterLocationChange(oldUrl, oldState);
14155
14190
  }
14156
- afterLocationChange(oldUrl, oldState);
14157
- }
14158
- });
14191
+ });
14192
+ }
14159
14193
  }
14160
14194
 
14161
14195
  $location.$$replace = false;
@@ -14233,7 +14267,7 @@ function $LogProvider() {
14233
14267
  this.debugEnabled = function(flag) {
14234
14268
  if (isDefined(flag)) {
14235
14269
  debug = flag;
14236
- return this;
14270
+ return this;
14237
14271
  } else {
14238
14272
  return debug;
14239
14273
  }
@@ -15055,6 +15089,13 @@ function findConstantAndWatchExpressions(ast, $filter) {
15055
15089
  if (!property.value.constant) {
15056
15090
  argsToWatch.push.apply(argsToWatch, property.value.toWatch);
15057
15091
  }
15092
+ if (property.computed) {
15093
+ findConstantAndWatchExpressions(property.key, $filter);
15094
+ if (!property.key.constant) {
15095
+ argsToWatch.push.apply(argsToWatch, property.key.toWatch);
15096
+ }
15097
+ }
15098
+
15058
15099
  });
15059
15100
  ast.constant = allConstants;
15060
15101
  ast.toWatch = argsToWatch;
@@ -16120,13 +16161,13 @@ function $ParseProvider() {
16120
16161
  }
16121
16162
  }
16122
16163
 
16123
- function expressionInputDirtyCheck(newValue, oldValueOfValue) {
16164
+ function expressionInputDirtyCheck(newValue, oldValueOfValue, compareObjectIdentity) {
16124
16165
 
16125
16166
  if (newValue == null || oldValueOfValue == null) { // null/undefined
16126
16167
  return newValue === oldValueOfValue;
16127
16168
  }
16128
16169
 
16129
- if (typeof newValue === 'object') {
16170
+ if (typeof newValue === 'object' && !compareObjectIdentity) {
16130
16171
 
16131
16172
  // attempt to convert the value to a primitive type
16132
16173
  // TODO(docs): add a note to docs that by implementing valueOf even objects and arrays can
@@ -16155,7 +16196,7 @@ function $ParseProvider() {
16155
16196
  inputExpressions = inputExpressions[0];
16156
16197
  return scope.$watch(function expressionInputWatch(scope) {
16157
16198
  var newInputValue = inputExpressions(scope);
16158
- if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf)) {
16199
+ if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf, parsedExpression.literal)) {
16159
16200
  lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]);
16160
16201
  oldInputValueOf = newInputValue && getValueOf(newInputValue);
16161
16202
  }
@@ -16175,7 +16216,7 @@ function $ParseProvider() {
16175
16216
 
16176
16217
  for (var i = 0, ii = inputExpressions.length; i < ii; i++) {
16177
16218
  var newInputValue = inputExpressions[i](scope);
16178
- if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i]))) {
16219
+ if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i], parsedExpression.literal))) {
16179
16220
  oldInputValues[i] = newInputValue;
16180
16221
  oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue);
16181
16222
  }
@@ -17868,6 +17909,10 @@ function $RootScopeProvider() {
17868
17909
  }
17869
17910
  }
17870
17911
  postDigestQueue.length = postDigestQueuePosition = 0;
17912
+
17913
+ // Check for changes to browser url that happened during the $digest
17914
+ // (for which no event is fired; e.g. via `history.pushState()`)
17915
+ $browser.$$checkUrlChange();
17871
17916
  },
17872
17917
 
17873
17918
 
@@ -19573,7 +19618,10 @@ function $SnifferProvider() {
19573
19618
  // (see https://developer.chrome.com/apps/api_index). If sandboxed, they can be detected by
19574
19619
  // the presence of an extension runtime ID and the absence of other Chrome runtime APIs
19575
19620
  // (see https://developer.chrome.com/apps/manifest/sandbox).
19621
+ // (NW.js apps have access to Chrome APIs, but do support `history`.)
19622
+ isNw = $window.nw && $window.nw.process,
19576
19623
  isChromePackagedApp =
19624
+ !isNw &&
19577
19625
  $window.chrome &&
19578
19626
  ($window.chrome.app && $window.chrome.app.runtime ||
19579
19627
  !$window.chrome.app && $window.chrome.runtime && $window.chrome.runtime.id),
@@ -22334,7 +22382,8 @@ var htmlAnchorDirective = valueFn({
22334
22382
  *
22335
22383
  * @description
22336
22384
  *
22337
- * This directive sets the `disabled` attribute on the element if the
22385
+ * This directive sets the `disabled` attribute on the element (typically a form control,
22386
+ * e.g. `input`, `button`, `select` etc.) if the
22338
22387
  * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.
22339
22388
  *
22340
22389
  * A special directive is necessary because we cannot use interpolation inside the `disabled`
@@ -24840,15 +24889,27 @@ function isValidForStep(viewValue, stepBase, step) {
24840
24889
  // and `viewValue` is expected to be a valid stringified number.
24841
24890
  var value = Number(viewValue);
24842
24891
 
24892
+ var isNonIntegerValue = !isNumberInteger(value);
24893
+ var isNonIntegerStepBase = !isNumberInteger(stepBase);
24894
+ var isNonIntegerStep = !isNumberInteger(step);
24895
+
24843
24896
  // Due to limitations in Floating Point Arithmetic (e.g. `0.3 - 0.2 !== 0.1` or
24844
24897
  // `0.5 % 0.1 !== 0`), we need to convert all numbers to integers.
24845
- if (!isNumberInteger(value) || !isNumberInteger(stepBase) || !isNumberInteger(step)) {
24846
- var decimalCount = Math.max(countDecimals(value), countDecimals(stepBase), countDecimals(step));
24898
+ if (isNonIntegerValue || isNonIntegerStepBase || isNonIntegerStep) {
24899
+ var valueDecimals = isNonIntegerValue ? countDecimals(value) : 0;
24900
+ var stepBaseDecimals = isNonIntegerStepBase ? countDecimals(stepBase) : 0;
24901
+ var stepDecimals = isNonIntegerStep ? countDecimals(step) : 0;
24902
+
24903
+ var decimalCount = Math.max(valueDecimals, stepBaseDecimals, stepDecimals);
24847
24904
  var multiplier = Math.pow(10, decimalCount);
24848
24905
 
24849
24906
  value = value * multiplier;
24850
24907
  stepBase = stepBase * multiplier;
24851
24908
  step = step * multiplier;
24909
+
24910
+ if (isNonIntegerValue) value = Math.round(value);
24911
+ if (isNonIntegerStepBase) stepBase = Math.round(stepBase);
24912
+ if (isNonIntegerStep) step = Math.round(step);
24852
24913
  }
24853
24914
 
24854
24915
  return (value - stepBase) % step === 0;
@@ -25405,7 +25466,10 @@ var ngValueDirective = function() {
25405
25466
  * makes it possible to use ngValue as a sort of one-way bind.
25406
25467
  */
25407
25468
  function updateElementValue(element, attr, value) {
25408
- element.prop('value', value);
25469
+ // Support: IE9 only
25470
+ // In IE9 values are converted to string (e.g. `input.value = null` results in `input.value === 'null'`).
25471
+ var propValue = isDefined(value) ? value : (msie === 9) ? '' : null;
25472
+ element.prop('value', propValue);
25409
25473
  attr.$set('value', value);
25410
25474
  }
25411
25475
 
@@ -26733,15 +26797,15 @@ forEach(
26733
26797
  return {
26734
26798
  restrict: 'A',
26735
26799
  compile: function($element, attr) {
26736
- // We expose the powerful $event object on the scope that provides access to the Window,
26737
- // etc. that isn't protected by the fast paths in $parse. We explicitly request better
26738
- // checks at the cost of speed since event handler expressions are not executed as
26739
- // frequently as regular change detection.
26740
- var fn = $parse(attr[directiveName], /* interceptorFn */ null, /* expensiveChecks */ true);
26800
+ // NOTE:
26801
+ // We expose the powerful `$event` object on the scope that provides access to the Window,
26802
+ // etc. This is OK, because expressions are not sandboxed any more (and the expression
26803
+ // sandbox was never meant to be a security feature anyway).
26804
+ var fn = $parse(attr[directiveName]);
26741
26805
  return function ngEventHandler(scope, element) {
26742
26806
  element.on(eventName, function(event) {
26743
26807
  var callback = function() {
26744
- fn(scope, {$event:event});
26808
+ fn(scope, {$event: event});
26745
26809
  };
26746
26810
  if (forceAsyncEvents[eventName] && $rootScope.$$phase) {
26747
26811
  scope.$evalAsync(callback);
@@ -28620,6 +28684,29 @@ NgModelController.prototype = {
28620
28684
  that.$commitViewValue();
28621
28685
  });
28622
28686
  }
28687
+ },
28688
+
28689
+ /**
28690
+ * @ngdoc method
28691
+ *
28692
+ * @name ngModel.NgModelController#$overrideModelOptions
28693
+ *
28694
+ * @description
28695
+ *
28696
+ * Override the current model options settings programmatically.
28697
+ *
28698
+ * The previous `ModelOptions` value will not be modified. Instead, a
28699
+ * new `ModelOptions` object will inherit from the previous one overriding
28700
+ * or inheriting settings that are defined in the given parameter.
28701
+ *
28702
+ * See {@link ngModelOptions} for information about what options can be specified
28703
+ * and how model option inheritance works.
28704
+ *
28705
+ * @param {Object} options a hash of settings to override the previous options
28706
+ *
28707
+ */
28708
+ $overrideModelOptions: function(options) {
28709
+ this.$options = this.$options.createChild(options);
28623
28710
  }
28624
28711
  };
28625
28712
 
@@ -30883,11 +30970,13 @@ var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
30883
30970
  * @multiElement
30884
30971
  *
30885
30972
  * @description
30886
- * The `ngShow` directive shows or hides the given HTML element based on the expression
30887
- * provided to the `ngShow` attribute. The element is shown or hidden by removing or adding
30888
- * the `.ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
30889
- * in AngularJS and sets the display style to none (using an !important flag).
30890
- * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
30973
+ * The `ngShow` directive shows or hides the given HTML element based on the expression provided to
30974
+ * the `ngShow` attribute.
30975
+ *
30976
+ * The element is shown or hidden by removing or adding the `.ng-hide` CSS class onto the element.
30977
+ * The `.ng-hide` CSS class is predefined in AngularJS and sets the display style to none (using an
30978
+ * `!important` flag). For CSP mode please add `angular-csp.css` to your HTML file (see
30979
+ * {@link ng.directive:ngCsp ngCsp}).
30891
30980
  *
30892
30981
  * ```html
30893
30982
  * <!-- when $scope.myValue is truthy (element is visible) -->
@@ -30897,31 +30986,32 @@ var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
30897
30986
  * <div ng-show="myValue" class="ng-hide"></div>
30898
30987
  * ```
30899
30988
  *
30900
- * When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added to the class
30901
- * attribute on the element causing it to become hidden. When truthy, the `.ng-hide` CSS class is removed
30902
- * from the element causing the element not to appear hidden.
30989
+ * When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added
30990
+ * to the class attribute on the element causing it to become hidden. When truthy, the `.ng-hide`
30991
+ * CSS class is removed from the element causing the element not to appear hidden.
30903
30992
  *
30904
- * ## Why is !important used?
30993
+ * ## Why is `!important` used?
30905
30994
  *
30906
- * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector
30907
- * can be easily overridden by heavier selectors. For example, something as simple
30908
- * as changing the display style on a HTML list item would make hidden elements appear visible.
30909
- * This also becomes a bigger issue when dealing with CSS frameworks.
30995
+ * You may be wondering why `!important` is used for the `.ng-hide` CSS class. This is because the
30996
+ * `.ng-hide` selector can be easily overridden by heavier selectors. For example, something as
30997
+ * simple as changing the display style on a HTML list item would make hidden elements appear
30998
+ * visible. This also becomes a bigger issue when dealing with CSS frameworks.
30910
30999
  *
30911
- * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
30912
- * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
30913
- * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
31000
+ * By using `!important`, the show and hide behavior will work as expected despite any clash between
31001
+ * CSS selector specificity (when `!important` isn't used with any conflicting styles). If a
31002
+ * developer chooses to override the styling to change how to hide an element then it is just a
31003
+ * matter of using `!important` in their own CSS code.
30914
31004
  *
30915
31005
  * ### Overriding `.ng-hide`
30916
31006
  *
30917
- * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change
30918
- * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
30919
- * class CSS. Note that the selector that needs to be used is actually `.ng-hide:not(.ng-hide-animate)` to cope
30920
- * with extra animation classes that can be added.
31007
+ * By default, the `.ng-hide` class will style the element with `display: none !important`. If you
31008
+ * wish to change the hide behavior with `ngShow`/`ngHide`, you can simply overwrite the styles for
31009
+ * the `.ng-hide` CSS class. Note that the selector that needs to be used is actually
31010
+ * `.ng-hide:not(.ng-hide-animate)` to cope with extra animation classes that can be added.
30921
31011
  *
30922
31012
  * ```css
30923
31013
  * .ng-hide:not(.ng-hide-animate) {
30924
- * /&#42; this is just another form of hiding an element &#42;/
31014
+ * /&#42; These are just alternative ways of hiding an element &#42;/
30925
31015
  * display: block!important;
30926
31016
  * position: absolute;
30927
31017
  * top: -9999px;
@@ -30929,29 +31019,20 @@ var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
30929
31019
  * }
30930
31020
  * ```
30931
31021
  *
30932
- * By default you don't need to override in CSS anything and the animations will work around the display style.
31022
+ * By default you don't need to override anything in CSS and the animations will work around the
31023
+ * display style.
30933
31024
  *
30934
31025
  * ## A note about animations with `ngShow`
30935
31026
  *
30936
- * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
30937
- * is true and false. This system works like the animation system present with ngClass except that
30938
- * you must also include the !important flag to override the display property
30939
- * so that you can perform an animation when the element is hidden during the time of the animation.
31027
+ * Animations in `ngShow`/`ngHide` work with the show and hide events that are triggered when the
31028
+ * directive expression is true and false. This system works like the animation system present with
31029
+ * `ngClass` except that you must also include the `!important` flag to override the display
31030
+ * property so that the elements are not actually hidden during the animation.
30940
31031
  *
30941
31032
  * ```css
30942
- * //
30943
- * //a working example can be found at the bottom of this page
30944
- * //
31033
+ * /&#42; A working example can be found at the bottom of this page. &#42;/
30945
31034
  * .my-element.ng-hide-add, .my-element.ng-hide-remove {
30946
- * /&#42; this is required as of 1.3x to properly
30947
- * apply all styling in a show/hide animation &#42;/
30948
- * transition: 0s linear all;
30949
- * }
30950
- *
30951
- * .my-element.ng-hide-add-active,
30952
- * .my-element.ng-hide-remove-active {
30953
- * /&#42; the transition is defined in the active class &#42;/
30954
- * transition: 1s linear all;
31035
+ * transition: all 0.5s linear;
30955
31036
  * }
30956
31037
  *
30957
31038
  * .my-element.ng-hide-add { ... }
@@ -30960,76 +31041,108 @@ var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
30960
31041
  * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
30961
31042
  * ```
30962
31043
  *
30963
- * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display
30964
- * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
31044
+ * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display property
31045
+ * to block during animation states - ngAnimate will automatically handle the style toggling for you.
30965
31046
  *
30966
31047
  * @animations
30967
- * | Animation | Occurs |
30968
- * |----------------------------------|-------------------------------------|
30969
- * | {@link $animate#addClass addClass} `.ng-hide` | after the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden |
30970
- * | {@link $animate#removeClass removeClass} `.ng-hide` | after the `ngShow` expression evaluates to a truthy value and just before contents are set to visible |
31048
+ * | Animation | Occurs |
31049
+ * |-----------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
31050
+ * | {@link $animate#addClass addClass} `.ng-hide` | After the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden. |
31051
+ * | {@link $animate#removeClass removeClass} `.ng-hide` | After the `ngShow` expression evaluates to a truthy value and just before contents are set to visible. |
30971
31052
  *
30972
31053
  * @element ANY
30973
- * @param {expression} ngShow If the {@link guide/expression expression} is truthy
30974
- * then the element is shown or hidden respectively.
31054
+ * @param {expression} ngShow If the {@link guide/expression expression} is truthy/falsy then the
31055
+ * element is shown/hidden respectively.
30975
31056
  *
30976
31057
  * @example
30977
- <example module="ngAnimate" deps="angular-animate.js" animations="true" name="ng-show">
31058
+ * A simple example, animating the element's opacity:
31059
+ *
31060
+ <example module="ngAnimate" deps="angular-animate.js" animations="true" name="ng-show-simple">
30978
31061
  <file name="index.html">
30979
- Click me: <input type="checkbox" ng-model="checked" aria-label="Toggle ngHide"><br/>
30980
- <div>
30981
- Show:
30982
- <div class="check-element animate-show" ng-show="checked">
30983
- <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
30984
- </div>
30985
- </div>
30986
- <div>
30987
- Hide:
30988
- <div class="check-element animate-show" ng-hide="checked">
30989
- <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
30990
- </div>
31062
+ Show: <input type="checkbox" ng-model="checked" aria-label="Toggle ngShow"><br />
31063
+ <div class="check-element animate-show-hide" ng-show="checked">
31064
+ I show up when your checkbox is checked.
30991
31065
  </div>
30992
31066
  </file>
30993
- <file name="glyphicons.css">
30994
- @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);
30995
- </file>
30996
31067
  <file name="animations.css">
30997
- .animate-show {
30998
- line-height: 20px;
31068
+ .animate-show-hide.ng-hide {
31069
+ opacity: 0;
31070
+ }
31071
+
31072
+ .animate-show-hide.ng-hide-add,
31073
+ .animate-show-hide.ng-hide-remove {
31074
+ transition: all linear 0.5s;
31075
+ }
31076
+
31077
+ .check-element {
31078
+ border: 1px solid black;
30999
31079
  opacity: 1;
31000
31080
  padding: 10px;
31001
- border: 1px solid black;
31002
- background: white;
31003
31081
  }
31082
+ </file>
31083
+ <file name="protractor.js" type="protractor">
31084
+ it('should check ngShow', function() {
31085
+ var checkbox = element(by.model('checked'));
31086
+ var checkElem = element(by.css('.check-element'));
31004
31087
 
31005
- .animate-show.ng-hide-add, .animate-show.ng-hide-remove {
31006
- transition: all linear 0.5s;
31088
+ expect(checkElem.isDisplayed()).toBe(false);
31089
+ checkbox.click();
31090
+ expect(checkElem.isDisplayed()).toBe(true);
31091
+ });
31092
+ </file>
31093
+ </example>
31094
+ *
31095
+ * <hr />
31096
+ * @example
31097
+ * A more complex example, featuring different show/hide animations:
31098
+ *
31099
+ <example module="ngAnimate" deps="angular-animate.js" animations="true" name="ng-show-complex">
31100
+ <file name="index.html">
31101
+ Show: <input type="checkbox" ng-model="checked" aria-label="Toggle ngShow"><br />
31102
+ <div class="check-element funky-show-hide" ng-show="checked">
31103
+ I show up when your checkbox is checked.
31104
+ </div>
31105
+ </file>
31106
+ <file name="animations.css">
31107
+ body {
31108
+ overflow: hidden;
31109
+ perspective: 1000px;
31007
31110
  }
31008
31111
 
31009
- .animate-show.ng-hide {
31010
- line-height: 0;
31011
- opacity: 0;
31012
- padding: 0 10px;
31112
+ .funky-show-hide.ng-hide-add {
31113
+ transform: rotateZ(0);
31114
+ transform-origin: right;
31115
+ transition: all 0.5s ease-in-out;
31116
+ }
31117
+
31118
+ .funky-show-hide.ng-hide-add.ng-hide-add-active {
31119
+ transform: rotateZ(-135deg);
31120
+ }
31121
+
31122
+ .funky-show-hide.ng-hide-remove {
31123
+ transform: rotateY(90deg);
31124
+ transform-origin: left;
31125
+ transition: all 0.5s ease;
31126
+ }
31127
+
31128
+ .funky-show-hide.ng-hide-remove.ng-hide-remove-active {
31129
+ transform: rotateY(0);
31013
31130
  }
31014
31131
 
31015
31132
  .check-element {
31016
- padding: 10px;
31017
31133
  border: 1px solid black;
31018
- background: white;
31134
+ opacity: 1;
31135
+ padding: 10px;
31019
31136
  }
31020
31137
  </file>
31021
31138
  <file name="protractor.js" type="protractor">
31022
- var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
31023
- var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
31139
+ it('should check ngShow', function() {
31140
+ var checkbox = element(by.model('checked'));
31141
+ var checkElem = element(by.css('.check-element'));
31024
31142
 
31025
- it('should check ng-show / ng-hide', function() {
31026
- expect(thumbsUp.isDisplayed()).toBeFalsy();
31027
- expect(thumbsDown.isDisplayed()).toBeTruthy();
31028
-
31029
- element(by.model('checked')).click();
31030
-
31031
- expect(thumbsUp.isDisplayed()).toBeTruthy();
31032
- expect(thumbsDown.isDisplayed()).toBeFalsy();
31143
+ expect(checkElem.isDisplayed()).toBe(false);
31144
+ checkbox.click();
31145
+ expect(checkElem.isDisplayed()).toBe(true);
31033
31146
  });
31034
31147
  </file>
31035
31148
  </example>
@@ -31059,11 +31172,13 @@ var ngShowDirective = ['$animate', function($animate) {
31059
31172
  * @multiElement
31060
31173
  *
31061
31174
  * @description
31062
- * The `ngHide` directive shows or hides the given HTML element based on the expression
31063
- * provided to the `ngHide` attribute. The element is shown or hidden by removing or adding
31064
- * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
31065
- * in AngularJS and sets the display style to none (using an !important flag).
31066
- * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
31175
+ * The `ngHide` directive shows or hides the given HTML element based on the expression provided to
31176
+ * the `ngHide` attribute.
31177
+ *
31178
+ * The element is shown or hidden by removing or adding the `.ng-hide` CSS class onto the element.
31179
+ * The `.ng-hide` CSS class is predefined in AngularJS and sets the display style to none (using an
31180
+ * `!important` flag). For CSP mode please add `angular-csp.css` to your HTML file (see
31181
+ * {@link ng.directive:ngCsp ngCsp}).
31067
31182
  *
31068
31183
  * ```html
31069
31184
  * <!-- when $scope.myValue is truthy (element is hidden) -->
@@ -31073,30 +31188,32 @@ var ngShowDirective = ['$animate', function($animate) {
31073
31188
  * <div ng-hide="myValue"></div>
31074
31189
  * ```
31075
31190
  *
31076
- * When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added to the class
31077
- * attribute on the element causing it to become hidden. When falsy, the `.ng-hide` CSS class is removed
31078
- * from the element causing the element not to appear hidden.
31191
+ * When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added
31192
+ * to the class attribute on the element causing it to become hidden. When falsy, the `.ng-hide`
31193
+ * CSS class is removed from the element causing the element not to appear hidden.
31079
31194
  *
31080
- * ## Why is !important used?
31195
+ * ## Why is `!important` used?
31081
31196
  *
31082
- * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector
31083
- * can be easily overridden by heavier selectors. For example, something as simple
31084
- * as changing the display style on a HTML list item would make hidden elements appear visible.
31085
- * This also becomes a bigger issue when dealing with CSS frameworks.
31197
+ * You may be wondering why `!important` is used for the `.ng-hide` CSS class. This is because the
31198
+ * `.ng-hide` selector can be easily overridden by heavier selectors. For example, something as
31199
+ * simple as changing the display style on a HTML list item would make hidden elements appear
31200
+ * visible. This also becomes a bigger issue when dealing with CSS frameworks.
31086
31201
  *
31087
- * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
31088
- * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
31089
- * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
31202
+ * By using `!important`, the show and hide behavior will work as expected despite any clash between
31203
+ * CSS selector specificity (when `!important` isn't used with any conflicting styles). If a
31204
+ * developer chooses to override the styling to change how to hide an element then it is just a
31205
+ * matter of using `!important` in their own CSS code.
31090
31206
  *
31091
31207
  * ### Overriding `.ng-hide`
31092
31208
  *
31093
- * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change
31094
- * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
31095
- * class in CSS:
31209
+ * By default, the `.ng-hide` class will style the element with `display: none !important`. If you
31210
+ * wish to change the hide behavior with `ngShow`/`ngHide`, you can simply overwrite the styles for
31211
+ * the `.ng-hide` CSS class. Note that the selector that needs to be used is actually
31212
+ * `.ng-hide:not(.ng-hide-animate)` to cope with extra animation classes that can be added.
31096
31213
  *
31097
31214
  * ```css
31098
- * .ng-hide {
31099
- * /&#42; this is just another form of hiding an element &#42;/
31215
+ * .ng-hide:not(.ng-hide-animate) {
31216
+ * /&#42; These are just alternative ways of hiding an element &#42;/
31100
31217
  * display: block!important;
31101
31218
  * position: absolute;
31102
31219
  * top: -9999px;
@@ -31104,20 +31221,20 @@ var ngShowDirective = ['$animate', function($animate) {
31104
31221
  * }
31105
31222
  * ```
31106
31223
  *
31107
- * By default you don't need to override in CSS anything and the animations will work around the display style.
31224
+ * By default you don't need to override in CSS anything and the animations will work around the
31225
+ * display style.
31108
31226
  *
31109
31227
  * ## A note about animations with `ngHide`
31110
31228
  *
31111
- * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
31112
- * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide`
31113
- * CSS class is added and removed for you instead of your own CSS class.
31229
+ * Animations in `ngShow`/`ngHide` work with the show and hide events that are triggered when the
31230
+ * directive expression is true and false. This system works like the animation system present with
31231
+ * `ngClass` except that you must also include the `!important` flag to override the display
31232
+ * property so that the elements are not actually hidden during the animation.
31114
31233
  *
31115
31234
  * ```css
31116
- * //
31117
- * //a working example can be found at the bottom of this page
31118
- * //
31235
+ * /&#42; A working example can be found at the bottom of this page. &#42;/
31119
31236
  * .my-element.ng-hide-add, .my-element.ng-hide-remove {
31120
- * transition: 0.5s linear all;
31237
+ * transition: all 0.5s linear;
31121
31238
  * }
31122
31239
  *
31123
31240
  * .my-element.ng-hide-add { ... }
@@ -31126,74 +31243,109 @@ var ngShowDirective = ['$animate', function($animate) {
31126
31243
  * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
31127
31244
  * ```
31128
31245
  *
31129
- * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display
31130
- * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
31246
+ * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display property
31247
+ * to block during animation states - ngAnimate will automatically handle the style toggling for you.
31131
31248
  *
31132
31249
  * @animations
31133
- * | Animation | Occurs |
31134
- * |----------------------------------|-------------------------------------|
31135
- * | {@link $animate#addClass addClass} `.ng-hide` | after the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden |
31136
- * | {@link $animate#removeClass removeClass} `.ng-hide` | after the `ngHide` expression evaluates to a non truthy value and just before contents are set to visible |
31250
+ * | Animation | Occurs |
31251
+ * |-----------------------------------------------------|------------------------------------------------------------------------------------------------------------|
31252
+ * | {@link $animate#addClass addClass} `.ng-hide` | After the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden. |
31253
+ * | {@link $animate#removeClass removeClass} `.ng-hide` | After the `ngHide` expression evaluates to a non truthy value and just before contents are set to visible. |
31137
31254
  *
31138
31255
  *
31139
31256
  * @element ANY
31140
- * @param {expression} ngHide If the {@link guide/expression expression} is truthy then
31141
- * the element is shown or hidden respectively.
31257
+ * @param {expression} ngHide If the {@link guide/expression expression} is truthy/falsy then the
31258
+ * element is hidden/shown respectively.
31142
31259
  *
31143
31260
  * @example
31144
- <example module="ngAnimate" deps="angular-animate.js" animations="true" name="ng-hide">
31261
+ * A simple example, animating the element's opacity:
31262
+ *
31263
+ <example module="ngAnimate" deps="angular-animate.js" animations="true" name="ng-hide-simple">
31145
31264
  <file name="index.html">
31146
- Click me: <input type="checkbox" ng-model="checked" aria-label="Toggle ngShow"><br/>
31147
- <div>
31148
- Show:
31149
- <div class="check-element animate-hide" ng-show="checked">
31150
- <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
31151
- </div>
31265
+ Hide: <input type="checkbox" ng-model="checked" aria-label="Toggle ngHide"><br />
31266
+ <div class="check-element animate-show-hide" ng-hide="checked">
31267
+ I hide when your checkbox is checked.
31152
31268
  </div>
31153
- <div>
31154
- Hide:
31155
- <div class="check-element animate-hide" ng-hide="checked">
31156
- <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
31157
- </div>
31158
- </div>
31159
- </file>
31160
- <file name="glyphicons.css">
31161
- @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);
31162
31269
  </file>
31163
31270
  <file name="animations.css">
31164
- .animate-hide {
31271
+ .animate-show-hide.ng-hide {
31272
+ opacity: 0;
31273
+ }
31274
+
31275
+ .animate-show-hide.ng-hide-add,
31276
+ .animate-show-hide.ng-hide-remove {
31165
31277
  transition: all linear 0.5s;
31166
- line-height: 20px;
31278
+ }
31279
+
31280
+ .check-element {
31281
+ border: 1px solid black;
31167
31282
  opacity: 1;
31168
31283
  padding: 10px;
31169
- border: 1px solid black;
31170
- background: white;
31171
31284
  }
31285
+ </file>
31286
+ <file name="protractor.js" type="protractor">
31287
+ it('should check ngHide', function() {
31288
+ var checkbox = element(by.model('checked'));
31289
+ var checkElem = element(by.css('.check-element'));
31172
31290
 
31173
- .animate-hide.ng-hide {
31174
- line-height: 0;
31175
- opacity: 0;
31176
- padding: 0 10px;
31291
+ expect(checkElem.isDisplayed()).toBe(true);
31292
+ checkbox.click();
31293
+ expect(checkElem.isDisplayed()).toBe(false);
31294
+ });
31295
+ </file>
31296
+ </example>
31297
+ *
31298
+ * <hr />
31299
+ * @example
31300
+ * A more complex example, featuring different show/hide animations:
31301
+ *
31302
+ <example module="ngAnimate" deps="angular-animate.js" animations="true" name="ng-hide-complex">
31303
+ <file name="index.html">
31304
+ Hide: <input type="checkbox" ng-model="checked" aria-label="Toggle ngHide"><br />
31305
+ <div class="check-element funky-show-hide" ng-hide="checked">
31306
+ I hide when your checkbox is checked.
31307
+ </div>
31308
+ </file>
31309
+ <file name="animations.css">
31310
+ body {
31311
+ overflow: hidden;
31312
+ perspective: 1000px;
31313
+ }
31314
+
31315
+ .funky-show-hide.ng-hide-add {
31316
+ transform: rotateZ(0);
31317
+ transform-origin: right;
31318
+ transition: all 0.5s ease-in-out;
31319
+ }
31320
+
31321
+ .funky-show-hide.ng-hide-add.ng-hide-add-active {
31322
+ transform: rotateZ(-135deg);
31323
+ }
31324
+
31325
+ .funky-show-hide.ng-hide-remove {
31326
+ transform: rotateY(90deg);
31327
+ transform-origin: left;
31328
+ transition: all 0.5s ease;
31329
+ }
31330
+
31331
+ .funky-show-hide.ng-hide-remove.ng-hide-remove-active {
31332
+ transform: rotateY(0);
31177
31333
  }
31178
31334
 
31179
31335
  .check-element {
31180
- padding: 10px;
31181
31336
  border: 1px solid black;
31182
- background: white;
31337
+ opacity: 1;
31338
+ padding: 10px;
31183
31339
  }
31184
31340
  </file>
31185
31341
  <file name="protractor.js" type="protractor">
31186
- var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
31187
- var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
31188
-
31189
- it('should check ng-show / ng-hide', function() {
31190
- expect(thumbsUp.isDisplayed()).toBeFalsy();
31191
- expect(thumbsDown.isDisplayed()).toBeTruthy();
31342
+ it('should check ngHide', function() {
31343
+ var checkbox = element(by.model('checked'));
31344
+ var checkElem = element(by.css('.check-element'));
31192
31345
 
31193
- element(by.model('checked')).click();
31194
-
31195
- expect(thumbsUp.isDisplayed()).toBeTruthy();
31196
- expect(thumbsDown.isDisplayed()).toBeFalsy();
31346
+ expect(checkElem.isDisplayed()).toBe(true);
31347
+ checkbox.click();
31348
+ expect(checkElem.isDisplayed()).toBe(false);
31197
31349
  });
31198
31350
  </file>
31199
31351
  </example>
@@ -31788,7 +31940,7 @@ var SelectController =
31788
31940
  ['$element', '$scope', /** @this */ function($element, $scope) {
31789
31941
 
31790
31942
  var self = this,
31791
- optionsMap = new HashMap();
31943
+ optionsMap = new NgMap();
31792
31944
 
31793
31945
  self.selectValueMap = {}; // Keys are the hashed values, values the original values
31794
31946
 
@@ -31909,7 +32061,7 @@ var SelectController =
31909
32061
  self.emptyOption = element;
31910
32062
  }
31911
32063
  var count = optionsMap.get(value) || 0;
31912
- optionsMap.put(value, count + 1);
32064
+ optionsMap.set(value, count + 1);
31913
32065
  // Only render at the end of a digest. This improves render performance when many options
31914
32066
  // are added during a digest and ensures all relevant options are correctly marked as selected
31915
32067
  scheduleRender();
@@ -31920,13 +32072,13 @@ var SelectController =
31920
32072
  var count = optionsMap.get(value);
31921
32073
  if (count) {
31922
32074
  if (count === 1) {
31923
- optionsMap.remove(value);
32075
+ optionsMap.delete(value);
31924
32076
  if (value === '') {
31925
32077
  self.hasEmptyOption = false;
31926
32078
  self.emptyOption = undefined;
31927
32079
  }
31928
32080
  } else {
31929
- optionsMap.put(value, count - 1);
32081
+ optionsMap.set(value, count - 1);
31930
32082
  }
31931
32083
  }
31932
32084
  };
@@ -32053,7 +32205,7 @@ var SelectController =
32053
32205
  var removeValue = optionAttrs.value;
32054
32206
 
32055
32207
  self.removeOption(removeValue);
32056
- self.ngModelCtrl.$render();
32208
+ scheduleRender();
32057
32209
 
32058
32210
  if (self.multiple && currentValue && currentValue.indexOf(removeValue) !== -1 ||
32059
32211
  currentValue === removeValue
@@ -32378,9 +32530,9 @@ var selectDirective = function() {
32378
32530
 
32379
32531
  // Write value now needs to set the selected property of each matching option
32380
32532
  selectCtrl.writeValue = function writeMultipleValue(value) {
32381
- var items = new HashMap(value);
32382
32533
  forEach(element.find('option'), function(option) {
32383
- option.selected = isDefined(items.get(option.value)) || isDefined(items.get(selectCtrl.selectValueMap[option.value]));
32534
+ option.selected = !!value && (includes(value, option.value) ||
32535
+ includes(value, selectCtrl.selectValueMap[option.value]));
32384
32536
  });
32385
32537
  };
32386
32538