@angular/router 5.2.2 → 5.2.6

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.
package/esm2015/router.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v5.2.2
2
+ * @license Angular v5.2.6
3
3
  * (c) 2010-2018 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -4173,14 +4173,15 @@ class Router {
4173
4173
  * @return {?}
4174
4174
  */
4175
4175
  setUpLocationChangeListener() {
4176
- // Zone.current.wrap is needed because of the issue with RxJS scheduler,
4177
- // which does not work properly with zone.js in IE and Safari
4176
+ // Don't need to use Zone.wrap any more, because zone.js
4177
+ // already patch onPopState, so location change callback will
4178
+ // run into ngZone
4178
4179
  if (!this.locationSubscription) {
4179
- this.locationSubscription = /** @type {?} */ (this.location.subscribe(Zone.current.wrap((change) => {
4180
+ this.locationSubscription = /** @type {?} */ (this.location.subscribe((change) => {
4180
4181
  const /** @type {?} */ rawUrlTree = this.urlSerializer.parse(change['url']);
4181
4182
  const /** @type {?} */ source = change['type'] === 'popstate' ? 'popstate' : 'hashchange';
4182
4183
  setTimeout(() => { this.scheduleNavigation(rawUrlTree, source, { replaceUrl: true }); }, 0);
4183
- })));
4184
+ }));
4184
4185
  }
4185
4186
  }
4186
4187
  /**
@@ -4564,66 +4565,82 @@ class Router {
4564
4565
  return { appliedUrl, state: null, shouldActivate };
4565
4566
  }
4566
4567
  });
4567
- // applied the new router state
4568
- // this operation has side effects
4569
- let /** @type {?} */ navigationIsSuccessful;
4570
- const /** @type {?} */ storedState = this.routerState;
4571
- const /** @type {?} */ storedUrl = this.currentUrlTree;
4572
- routerState$
4573
- .forEach(({ appliedUrl, state, shouldActivate }) => {
4574
- if (!shouldActivate || id !== this.navigationId) {
4575
- navigationIsSuccessful = false;
4576
- return;
4577
- }
4578
- this.currentUrlTree = appliedUrl;
4579
- this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, rawUrl);
4580
- (/** @type {?} */ (this)).routerState = state;
4581
- if (!skipLocationChange) {
4582
- const /** @type {?} */ path = this.urlSerializer.serialize(this.rawUrlTree);
4583
- if (this.location.isCurrentPathEqualTo(path) || replaceUrl) {
4584
- this.location.replaceState(path);
4585
- }
4586
- else {
4587
- this.location.go(path);
4588
- }
4589
- }
4590
- new ActivateRoutes(this.routeReuseStrategy, state, storedState, (evt) => this.triggerEvent(evt))
4591
- .activate(this.rootContexts);
4592
- navigationIsSuccessful = true;
4593
- })
4594
- .then(() => {
4595
- if (navigationIsSuccessful) {
4596
- this.navigated = true;
4597
- (/** @type {?} */ (this.events))
4598
- .next(new NavigationEnd(id, this.serializeUrl(url), this.serializeUrl(this.currentUrlTree)));
4599
- resolvePromise(true);
4568
+ this.activateRoutes(routerState$, this.routerState, this.currentUrlTree, id, url, rawUrl, skipLocationChange, replaceUrl, resolvePromise, rejectPromise);
4569
+ });
4570
+ }
4571
+ /**
4572
+ * Performs the logic of activating routes. This is a synchronous process by default. While this
4573
+ * is a private method, it could be overridden to make activation asynchronous.
4574
+ * @param {?} state
4575
+ * @param {?} storedState
4576
+ * @param {?} storedUrl
4577
+ * @param {?} id
4578
+ * @param {?} url
4579
+ * @param {?} rawUrl
4580
+ * @param {?} skipLocationChange
4581
+ * @param {?} replaceUrl
4582
+ * @param {?} resolvePromise
4583
+ * @param {?} rejectPromise
4584
+ * @return {?}
4585
+ */
4586
+ activateRoutes(state, storedState, storedUrl, id, url, rawUrl, skipLocationChange, replaceUrl, resolvePromise, rejectPromise) {
4587
+ // applied the new router state
4588
+ // this operation has side effects
4589
+ let /** @type {?} */ navigationIsSuccessful;
4590
+ state
4591
+ .forEach(({ appliedUrl, state, shouldActivate }) => {
4592
+ if (!shouldActivate || id !== this.navigationId) {
4593
+ navigationIsSuccessful = false;
4594
+ return;
4595
+ }
4596
+ this.currentUrlTree = appliedUrl;
4597
+ this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, rawUrl);
4598
+ (/** @type {?} */ (this)).routerState = state;
4599
+ if (!skipLocationChange) {
4600
+ const /** @type {?} */ path = this.urlSerializer.serialize(this.rawUrlTree);
4601
+ if (this.location.isCurrentPathEqualTo(path) || replaceUrl) {
4602
+ this.location.replaceState(path);
4600
4603
  }
4601
4604
  else {
4602
- this.resetUrlToCurrentUrlTree();
4603
- (/** @type {?} */ (this.events))
4604
- .next(new NavigationCancel(id, this.serializeUrl(url), ''));
4605
- resolvePromise(false);
4605
+ this.location.go(path);
4606
4606
  }
4607
- }, (e) => {
4608
- if (isNavigationCancelingError(e)) {
4609
- this.navigated = true;
4610
- this.resetStateAndUrl(storedState, storedUrl, rawUrl);
4611
- (/** @type {?} */ (this.events))
4612
- .next(new NavigationCancel(id, this.serializeUrl(url), e.message));
4613
- resolvePromise(false);
4607
+ }
4608
+ new ActivateRoutes(this.routeReuseStrategy, state, storedState, (evt) => this.triggerEvent(evt))
4609
+ .activate(this.rootContexts);
4610
+ navigationIsSuccessful = true;
4611
+ })
4612
+ .then(() => {
4613
+ if (navigationIsSuccessful) {
4614
+ this.navigated = true;
4615
+ (/** @type {?} */ (this.events))
4616
+ .next(new NavigationEnd(id, this.serializeUrl(url), this.serializeUrl(this.currentUrlTree)));
4617
+ resolvePromise(true);
4618
+ }
4619
+ else {
4620
+ this.resetUrlToCurrentUrlTree();
4621
+ (/** @type {?} */ (this.events))
4622
+ .next(new NavigationCancel(id, this.serializeUrl(url), ''));
4623
+ resolvePromise(false);
4624
+ }
4625
+ }, (e) => {
4626
+ if (isNavigationCancelingError(e)) {
4627
+ this.navigated = true;
4628
+ this.resetStateAndUrl(storedState, storedUrl, rawUrl);
4629
+ (/** @type {?} */ (this.events))
4630
+ .next(new NavigationCancel(id, this.serializeUrl(url), e.message));
4631
+ resolvePromise(false);
4632
+ }
4633
+ else {
4634
+ this.resetStateAndUrl(storedState, storedUrl, rawUrl);
4635
+ (/** @type {?} */ (this.events))
4636
+ .next(new NavigationError(id, this.serializeUrl(url), e));
4637
+ try {
4638
+ resolvePromise(this.errorHandler(e));
4614
4639
  }
4615
- else {
4616
- this.resetStateAndUrl(storedState, storedUrl, rawUrl);
4617
- (/** @type {?} */ (this.events))
4618
- .next(new NavigationError(id, this.serializeUrl(url), e));
4619
- try {
4620
- resolvePromise(this.errorHandler(e));
4621
- }
4622
- catch (/** @type {?} */ ee) {
4623
- rejectPromise(ee);
4624
- }
4640
+ catch (/** @type {?} */ ee) {
4641
+ rejectPromise(ee);
4625
4642
  }
4626
- });
4643
+ }
4627
4644
  });
4628
4645
  }
4629
4646
  /**
@@ -6232,7 +6249,7 @@ function provideRouterInitializer() {
6232
6249
  /**
6233
6250
  * \@stable
6234
6251
  */
6235
- const VERSION = new Version('5.2.2');
6252
+ const VERSION = new Version('5.2.6');
6236
6253
 
6237
6254
  /**
6238
6255
  * @fileoverview added by tsickle