UNPKG

@angular/router

Version:
810 lines 135 kB
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { Location } from '@angular/common'; import { Compiler, Injectable, Injector, isDevMode, NgModuleFactoryLoader, NgModuleRef, NgZone, Type, ɵConsole as Console } from '@angular/core'; import { BehaviorSubject, EMPTY, of, Subject } from 'rxjs'; import { catchError, filter, finalize, map, switchMap, tap } from 'rxjs/operators'; import { standardizeConfig, validateConfig } from './config'; import { createRouterState } from './create_router_state'; import { createUrlTree } from './create_url_tree'; import { GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RoutesRecognized } from './events'; import { activateRoutes } from './operators/activate_routes'; import { applyRedirects } from './operators/apply_redirects'; import { checkGuards } from './operators/check_guards'; import { recognize } from './operators/recognize'; import { resolveData } from './operators/resolve_data'; import { switchTap } from './operators/switch_tap'; import { DefaultRouteReuseStrategy } from './route_reuse_strategy'; import { RouterConfigLoader } from './router_config_loader'; import { ChildrenOutletContexts } from './router_outlet_context'; import { createEmptyState } from './router_state'; import { isNavigationCancelingError, navigationCancelingError } from './shared'; import { DefaultUrlHandlingStrategy } from './url_handling_strategy'; import { containsTree, createEmptyUrlTree, UrlSerializer } from './url_tree'; import { getAllRouteGuards } from './utils/preactivation'; import { isUrlTree } from './utils/type_guards'; function defaultErrorHandler(error) { throw error; } function defaultMalformedUriErrorHandler(error, urlSerializer, url) { return urlSerializer.parse('/'); } /** * @internal */ function defaultRouterHook(snapshot, runExtras) { return of(null); } /** * @description * * A service that provides navigation and URL manipulation capabilities. * * @see `Route`. * @see [Routing and Navigation Guide](guide/router). * * @ngModule RouterModule * * @publicApi */ export class Router { /** * Creates the router service. */ // TODO: vsavkin make internal after the final is out. constructor(rootComponentType, urlSerializer, rootContexts, location, injector, loader, compiler, config) { this.rootComponentType = rootComponentType; this.urlSerializer = urlSerializer; this.rootContexts = rootContexts; this.location = location; this.config = config; this.lastSuccessfulNavigation = null; this.currentNavigation = null; this.navigationId = 0; this.isNgZoneEnabled = false; /** * An event stream for routing events in this NgModule. */ this.events = new Subject(); /** * A handler for navigation errors in this NgModule. */ this.errorHandler = defaultErrorHandler; /** * A handler for errors thrown by `Router.parseUrl(url)` * when `url` contains an invalid character. * The most common case is a `%` sign * that's not encoded and is not part of a percent encoded sequence. */ this.malformedUriErrorHandler = defaultMalformedUriErrorHandler; /** * True if at least one navigation event has occurred, * false otherwise. */ this.navigated = false; this.lastSuccessfulId = -1; /** * Hooks that enable you to pause navigation, * either before or after the preactivation phase. * Used by `RouterModule`. * * @internal */ this.hooks = { beforePreactivation: defaultRouterHook, afterPreactivation: defaultRouterHook }; /** * A strategy for extracting and merging URLs. * Used for AngularJS to Angular migrations. */ this.urlHandlingStrategy = new DefaultUrlHandlingStrategy(); /** * A strategy for re-using routes. */ this.routeReuseStrategy = new DefaultRouteReuseStrategy(); /** * How to handle a navigation request to the current URL. One of: * - `'ignore'` : The router ignores the request. * - `'reload'` : The router reloads the URL. Use to implement a "refresh" feature. */ this.onSameUrlNavigation = 'ignore'; /** * How to merge parameters, data, and resolved data from parent to child * routes. One of: * * - `'emptyOnly'` : Inherit parent parameters, data, and resolved data * for path-less or component-less routes. * - `'always'` : Inherit parent parameters, data, and resolved data * for all child routes. */ this.paramsInheritanceStrategy = 'emptyOnly'; /** * Determines when the router updates the browser URL. * By default (`"deferred"`), updates the browser URL after navigation has finished. * Set to `'eager'` to update the browser URL at the beginning of navigation. * You can choose to update early so that, if navigation fails, * you can show an error message with the URL that failed. */ this.urlUpdateStrategy = 'deferred'; /** * Enables a bug fix that corrects relative link resolution in components with empty paths. * @see `RouterModule` */ this.relativeLinkResolution = 'legacy'; const onLoadStart = (r) => this.triggerEvent(new RouteConfigLoadStart(r)); const onLoadEnd = (r) => this.triggerEvent(new RouteConfigLoadEnd(r)); this.ngModule = injector.get(NgModuleRef); this.console = injector.get(Console); const ngZone = injector.get(NgZone); this.isNgZoneEnabled = ngZone instanceof NgZone; this.resetConfig(config); this.currentUrlTree = createEmptyUrlTree(); this.rawUrlTree = this.currentUrlTree; this.browserUrlTree = this.currentUrlTree; this.configLoader = new RouterConfigLoader(loader, compiler, onLoadStart, onLoadEnd); this.routerState = createEmptyState(this.currentUrlTree, this.rootComponentType); this.transitions = new BehaviorSubject({ id: 0, currentUrlTree: this.currentUrlTree, currentRawUrl: this.currentUrlTree, extractedUrl: this.urlHandlingStrategy.extract(this.currentUrlTree), urlAfterRedirects: this.urlHandlingStrategy.extract(this.currentUrlTree), rawUrl: this.currentUrlTree, extras: {}, resolve: null, reject: null, promise: Promise.resolve(true), source: 'imperative', restoredState: null, currentSnapshot: this.routerState.snapshot, targetSnapshot: null, currentRouterState: this.routerState, targetRouterState: null, guards: { canActivateChecks: [], canDeactivateChecks: [] }, guardsResult: null, }); this.navigations = this.setupNavigations(this.transitions); this.processNavigations(); } setupNavigations(transitions) { const eventsSubject = this.events; return transitions.pipe(filter(t => t.id !== 0), // Extract URL map(t => (Object.assign(Object.assign({}, t), { extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl) }))), // Using switchMap so we cancel executing navigations when a new one comes in switchMap(t => { let completed = false; let errored = false; return of(t).pipe( // Store the Navigation object tap(t => { this.currentNavigation = { id: t.id, initialUrl: t.currentRawUrl, extractedUrl: t.extractedUrl, trigger: t.source, extras: t.extras, previousNavigation: this.lastSuccessfulNavigation ? Object.assign(Object.assign({}, this.lastSuccessfulNavigation), { previousNavigation: null }) : null }; }), switchMap(t => { const urlTransition = !this.navigated || t.extractedUrl.toString() !== this.browserUrlTree.toString(); const processCurrentUrl = (this.onSameUrlNavigation === 'reload' ? true : urlTransition) && this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl); if (processCurrentUrl) { return of(t).pipe( // Fire NavigationStart event switchMap(t => { const transition = this.transitions.getValue(); eventsSubject.next(new NavigationStart(t.id, this.serializeUrl(t.extractedUrl), t.source, t.restoredState)); if (transition !== this.transitions.getValue()) { return EMPTY; } return [t]; }), // This delay is required to match old behavior that forced navigation // to always be async switchMap(t => Promise.resolve(t)), // ApplyRedirects applyRedirects(this.ngModule.injector, this.configLoader, this.urlSerializer, this.config), // Update the currentNavigation tap(t => { this.currentNavigation = Object.assign(Object.assign({}, this.currentNavigation), { finalUrl: t.urlAfterRedirects }); }), // Recognize recognize(this.rootComponentType, this.config, (url) => this.serializeUrl(url), this.paramsInheritanceStrategy, this.relativeLinkResolution), // Update URL if in `eager` update mode tap(t => { if (this.urlUpdateStrategy === 'eager') { if (!t.extras.skipLocationChange) { this.setBrowserUrl(t.urlAfterRedirects, !!t.extras.replaceUrl, t.id, t.extras.state); } this.browserUrlTree = t.urlAfterRedirects; } }), // Fire RoutesRecognized tap(t => { const routesRecognized = new RoutesRecognized(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot); eventsSubject.next(routesRecognized); })); } else { const processPreviousUrl = urlTransition && this.rawUrlTree && this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree); /* When the current URL shouldn't be processed, but the previous one was, * we handle this "error condition" by navigating to the previously * successful URL, but leaving the URL intact.*/ if (processPreviousUrl) { const { id, extractedUrl, source, restoredState, extras } = t; const navStart = new NavigationStart(id, this.serializeUrl(extractedUrl), source, restoredState); eventsSubject.next(navStart); const targetSnapshot = createEmptyState(extractedUrl, this.rootComponentType).snapshot; return of(Object.assign(Object.assign({}, t), { targetSnapshot, urlAfterRedirects: extractedUrl, extras: Object.assign(Object.assign({}, extras), { skipLocationChange: false, replaceUrl: false }) })); } else { /* When neither the current or previous URL can be processed, do nothing * other than update router's internal reference to the current "settled" * URL. This way the next navigation will be coming from the current URL * in the browser. */ this.rawUrlTree = t.rawUrl; this.browserUrlTree = t.urlAfterRedirects; t.resolve(null); return EMPTY; } } }), // Before Preactivation switchTap(t => { const { targetSnapshot, id: navigationId, extractedUrl: appliedUrlTree, rawUrl: rawUrlTree, extras: { skipLocationChange, replaceUrl } } = t; return this.hooks.beforePreactivation(targetSnapshot, { navigationId, appliedUrlTree, rawUrlTree, skipLocationChange: !!skipLocationChange, replaceUrl: !!replaceUrl, }); }), // --- GUARDS --- tap(t => { const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot); this.triggerEvent(guardsStart); }), map(t => (Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts) }))), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => { if (isUrlTree(t.guardsResult)) { const error = navigationCancelingError(`Redirecting to "${this.serializeUrl(t.guardsResult)}"`); error.url = t.guardsResult; throw error; } }), tap(t => { const guardsEnd = new GuardsCheckEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult); this.triggerEvent(guardsEnd); }), filter(t => { if (!t.guardsResult) { this.resetUrlToCurrentUrlTree(); const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), ''); eventsSubject.next(navCancel); t.resolve(false); return false; } return true; }), // --- RESOLVE --- switchTap(t => { if (t.guards.canActivateChecks.length) { return of(t).pipe(tap(t => { const resolveStart = new ResolveStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot); this.triggerEvent(resolveStart); }), switchMap(t => { let dataResolved = false; return of(t).pipe(resolveData(this.paramsInheritanceStrategy, this.ngModule.injector), tap({ next: () => dataResolved = true, complete: () => { if (!dataResolved) { const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), `At least one route resolver didn't emit any value.`); eventsSubject.next(navCancel); t.resolve(false); } } })); }), tap(t => { const resolveEnd = new ResolveEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot); this.triggerEvent(resolveEnd); })); } return undefined; }), // --- AFTER PREACTIVATION --- switchTap((t) => { const { targetSnapshot, id: navigationId, extractedUrl: appliedUrlTree, rawUrl: rawUrlTree, extras: { skipLocationChange, replaceUrl } } = t; return this.hooks.afterPreactivation(targetSnapshot, { navigationId, appliedUrlTree, rawUrlTree, skipLocationChange: !!skipLocationChange, replaceUrl: !!replaceUrl, }); }), map((t) => { const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState); return (Object.assign(Object.assign({}, t), { targetRouterState })); }), /* Once here, we are about to activate syncronously. The assumption is this will succeed, and user code may read from the Router service. Therefore before activation, we need to update router properties storing the current URL and the RouterState, as well as updated the browser URL. All this should happen *before* activating. */ tap((t) => { this.currentUrlTree = t.urlAfterRedirects; this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, t.rawUrl); this.routerState = t.targetRouterState; if (this.urlUpdateStrategy === 'deferred') { if (!t.extras.skipLocationChange) { this.setBrowserUrl(this.rawUrlTree, !!t.extras.replaceUrl, t.id, t.extras.state); } this.browserUrlTree = t.urlAfterRedirects; } }), activateRoutes(this.rootContexts, this.routeReuseStrategy, (evt) => this.triggerEvent(evt)), tap({ next() { completed = true; }, complete() { completed = true; } }), finalize(() => { /* When the navigation stream finishes either through error or success, we * set the `completed` or `errored` flag. However, there are some situations * where we could get here without either of those being set. For instance, a * redirect during NavigationStart. Therefore, this is a catch-all to make * sure the NavigationCancel * event is fired when a navigation gets cancelled but not caught by other * means. */ if (!completed && !errored) { // Must reset to current URL tree here to ensure history.state is set. On a // fresh page load, if a new navigation comes in before a successful // navigation completes, there will be nothing in // history.state.navigationId. This can cause sync problems with AngularJS // sync code which looks for a value here in order to determine whether or // not to handle a given popstate event or to leave it to the Angualr // router. this.resetUrlToCurrentUrlTree(); const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), `Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}`); eventsSubject.next(navCancel); t.resolve(false); } // currentNavigation should always be reset to null here. If navigation was // successful, lastSuccessfulTransition will have already been set. Therefore // we can safely set currentNavigation to null here. this.currentNavigation = null; }), catchError((e) => { errored = true; /* This error type is issued during Redirect, and is handled as a * cancellation rather than an error. */ if (isNavigationCancelingError(e)) { const redirecting = isUrlTree(e.url); if (!redirecting) { // Set property only if we're not redirecting. If we landed on a page and // redirect to `/` route, the new navigation is going to see the `/` // isn't a change from the default currentUrlTree and won't navigate. // This is only applicable with initial navigation, so setting // `navigated` only when not redirecting resolves this scenario. this.navigated = true; this.resetStateAndUrl(t.currentRouterState, t.currentUrlTree, t.rawUrl); } const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message); eventsSubject.next(navCancel); // When redirecting, we need to delay resolving the navigation // promise and push it to the redirect navigation if (!redirecting) { t.resolve(false); } else { // setTimeout is required so this navigation finishes with // the return EMPTY below. If it isn't allowed to finish // processing, there can be multiple navigations to the same // URL. setTimeout(() => { const mergedTree = this.urlHandlingStrategy.merge(e.url, this.rawUrlTree); const extras = { skipLocationChange: t.extras.skipLocationChange, replaceUrl: this.urlUpdateStrategy === 'eager' }; return this.scheduleNavigation(mergedTree, 'imperative', null, extras, { resolve: t.resolve, reject: t.reject, promise: t.promise }); }, 0); } /* All other errors should reset to the router's internal URL reference to * the pre-error state. */ } else { this.resetStateAndUrl(t.currentRouterState, t.currentUrlTree, t.rawUrl); const navError = new NavigationError(t.id, this.serializeUrl(t.extractedUrl), e); eventsSubject.next(navError); try { t.resolve(this.errorHandler(e)); } catch (ee) { t.reject(ee); } } return EMPTY; })); // TODO(jasonaden): remove cast once g3 is on updated TypeScript })); } /** * @internal * TODO: this should be removed once the constructor of the router made internal */ resetRootComponentType(rootComponentType) { this.rootComponentType = rootComponentType; // TODO: vsavkin router 4.0 should make the root component set to null // this will simplify the lifecycle of the router. this.routerState.root.component = this.rootComponentType; } getTransition() { const transition = this.transitions.value; // This value needs to be set. Other values such as extractedUrl are set on initial navigation // but the urlAfterRedirects may not get set if we aren't processing the new URL *and* not // processing the previous URL. transition.urlAfterRedirects = this.browserUrlTree; return transition; } setTransition(t) { this.transitions.next(Object.assign(Object.assign({}, this.getTransition()), t)); } /** * Sets up the location change listener and performs the initial navigation. */ initialNavigation() { this.setUpLocationChangeListener(); if (this.navigationId === 0) { this.navigateByUrl(this.location.path(true), { replaceUrl: true }); } } /** * Sets up the location change listener. */ setUpLocationChangeListener() { // Don't need to use Zone.wrap any more, because zone.js // already patch onPopState, so location change callback will // run into ngZone if (!this.locationSubscription) { this.locationSubscription = this.location.subscribe((change) => { let rawUrlTree = this.parseUrl(change['url']); const source = change['type'] === 'popstate' ? 'popstate' : 'hashchange'; // Navigations coming from Angular router have a navigationId state property. When this // exists, restore the state. const state = change.state && change.state.navigationId ? change.state : null; setTimeout(() => { this.scheduleNavigation(rawUrlTree, source, state, { replaceUrl: true }); }, 0); }); } } /** The current URL. */ get url() { return this.serializeUrl(this.currentUrlTree); } /** The current Navigation object if one exists */ getCurrentNavigation() { return this.currentNavigation; } /** @internal */ triggerEvent(event) { this.events.next(event); } /** * Resets the configuration used for navigation and generating links. * * @param config The route array for the new configuration. * * @usageNotes * * ``` * router.resetConfig([ * { path: 'team/:id', component: TeamCmp, children: [ * { path: 'simple', component: SimpleCmp }, * { path: 'user/:name', component: UserCmp } * ]} * ]); * ``` */ resetConfig(config) { validateConfig(config); this.config = config.map(standardizeConfig); this.navigated = false; this.lastSuccessfulId = -1; } /** @docsNotRequired */ ngOnDestroy() { this.dispose(); } /** Disposes of the router. */ dispose() { if (this.locationSubscription) { this.locationSubscription.unsubscribe(); this.locationSubscription = null; } } /** * Applies an array of commands to the current URL tree and creates a new URL tree. * * When given an activated route, applies the given commands starting from the route. * Otherwise, applies the given command starting from the root. * * @param commands An array of commands to apply. * @param navigationExtras Options that control the navigation strategy. This function * only utilizes properties in `NavigationExtras` that would change the provided URL. * @returns The new URL tree. * * @usageNotes * * ``` * // create /team/33/user/11 * router.createUrlTree(['/team', 33, 'user', 11]); * * // create /team/33;expand=true/user/11 * router.createUrlTree(['/team', 33, {expand: true}, 'user', 11]); * * // you can collapse static segments like this (this works only with the first passed-in value): * router.createUrlTree(['/team/33/user', userId]); * * // If the first segment can contain slashes, and you do not want the router to split it, * // you can do the following: * router.createUrlTree([{segmentPath: '/one/two'}]); * * // create /team/33/(user/11//right:chat) * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: 'chat'}}]); * * // remove the right secondary node * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: null}}]); * * // assuming the current url is `/team/33/user/11` and the route points to `user/11` * * // navigate to /team/33/user/11/details * router.createUrlTree(['details'], {relativeTo: route}); * * // navigate to /team/33/user/22 * router.createUrlTree(['../22'], {relativeTo: route}); * * // navigate to /team/44/user/22 * router.createUrlTree(['../../team/44/user/22'], {relativeTo: route}); * ``` */ createUrlTree(commands, navigationExtras = {}) { const { relativeTo, queryParams, fragment, preserveQueryParams, queryParamsHandling, preserveFragment } = navigationExtras; if (isDevMode() && preserveQueryParams && console && console.warn) { console.warn('preserveQueryParams is deprecated, use queryParamsHandling instead.'); } const a = relativeTo || this.routerState.root; const f = preserveFragment ? this.currentUrlTree.fragment : fragment; let q = null; if (queryParamsHandling) { switch (queryParamsHandling) { case 'merge': q = Object.assign(Object.assign({}, this.currentUrlTree.queryParams), queryParams); break; case 'preserve': q = this.currentUrlTree.queryParams; break; default: q = queryParams || null; } } else { q = preserveQueryParams ? this.currentUrlTree.queryParams : queryParams || null; } if (q !== null) { q = this.removeEmptyProps(q); } return createUrlTree(a, this.currentUrlTree, commands, q, f); } /** * Navigate based on the provided URL, which must be absolute. * * @param url An absolute URL. The function does not apply any delta to the current URL. * @param extras An object containing properties that modify the navigation strategy. * The function ignores any properties in the `NavigationExtras` that would change the * provided URL. * * @returns A Promise that resolves to 'true' when navigation succeeds, * to 'false' when navigation fails, or is rejected on error. * * @usageNotes * * ``` * router.navigateByUrl("/team/33/user/11"); * * // Navigate without updating the URL * router.navigateByUrl("/team/33/user/11", { skipLocationChange: true }); * ``` * */ navigateByUrl(url, extras = { skipLocationChange: false }) { if (isDevMode() && this.isNgZoneEnabled && !NgZone.isInAngularZone()) { this.console.warn(`Navigation triggered outside Angular zone, did you forget to call 'ngZone.run()'?`); } const urlTree = isUrlTree(url) ? url : this.parseUrl(url); const mergedTree = this.urlHandlingStrategy.merge(urlTree, this.rawUrlTree); return this.scheduleNavigation(mergedTree, 'imperative', null, extras); } /** * Navigate based on the provided array of commands and a starting point. * If no starting route is provided, the navigation is absolute. * * Returns a promise that: * - resolves to 'true' when navigation succeeds, * - resolves to 'false' when navigation fails, * - is rejected when an error happens. * * @usageNotes * * ``` * router.navigate(['team', 33, 'user', 11], {relativeTo: route}); * * // Navigate without updating the URL * router.navigate(['team', 33, 'user', 11], {relativeTo: route, skipLocationChange: true}); * ``` * * The first parameter of `navigate()` is a delta to be applied to the current URL * or the one provided in the `relativeTo` property of the second parameter (the * `NavigationExtras`). * * In order to affect this browser's `history.state` entry, the `state` * parameter can be passed. This must be an object because the router * will add the `navigationId` property to this object before creating * the new history item. */ navigate(commands, extras = { skipLocationChange: false }) { validateCommands(commands); return this.navigateByUrl(this.createUrlTree(commands, extras), extras); } /** Serializes a `UrlTree` into a string */ serializeUrl(url) { return this.urlSerializer.serialize(url); } /** Parses a string into a `UrlTree` */ parseUrl(url) { let urlTree; try { urlTree = this.urlSerializer.parse(url); } catch (e) { urlTree = this.malformedUriErrorHandler(e, this.urlSerializer, url); } return urlTree; } /** Returns whether the url is activated */ isActive(url, exact) { if (isUrlTree(url)) { return containsTree(this.currentUrlTree, url, exact); } const urlTree = this.parseUrl(url); return containsTree(this.currentUrlTree, urlTree, exact); } removeEmptyProps(params) { return Object.keys(params).reduce((result, key) => { const value = params[key]; if (value !== null && value !== undefined) { result[key] = value; } return result; }, {}); } processNavigations() { this.navigations.subscribe(t => { this.navigated = true; this.lastSuccessfulId = t.id; this.events .next(new NavigationEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(this.currentUrlTree))); this.lastSuccessfulNavigation = this.currentNavigation; this.currentNavigation = null; t.resolve(true); }, e => { this.console.warn(`Unhandled Navigation Error: `); }); } scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) { const lastNavigation = this.getTransition(); // If the user triggers a navigation imperatively (e.g., by using navigateByUrl), // and that navigation results in 'replaceState' that leads to the same URL, // we should skip those. if (lastNavigation && source !== 'imperative' && lastNavigation.source === 'imperative' && lastNavigation.rawUrl.toString() === rawUrl.toString()) { return Promise.resolve(true); // return value is not used } // Because of a bug in IE and Edge, the location class fires two events (popstate and // hashchange) every single time. The second one should be ignored. Otherwise, the URL will // flicker. Handles the case when a popstate was emitted first. if (lastNavigation && source == 'hashchange' && lastNavigation.source === 'popstate' && lastNavigation.rawUrl.toString() === rawUrl.toString()) { return Promise.resolve(true); // return value is not used } // Because of a bug in IE and Edge, the location class fires two events (popstate and // hashchange) every single time. The second one should be ignored. Otherwise, the URL will // flicker. Handles the case when a hashchange was emitted first. if (lastNavigation && source == 'popstate' && lastNavigation.source === 'hashchange' && lastNavigation.rawUrl.toString() === rawUrl.toString()) { return Promise.resolve(true); // return value is not used } let resolve; let reject; let promise; if (priorPromise) { resolve = priorPromise.resolve; reject = priorPromise.reject; promise = priorPromise.promise; } else { promise = new Promise((res, rej) => { resolve = res; reject = rej; }); } const id = ++this.navigationId; this.setTransition({ id, source, restoredState, currentUrlTree: this.currentUrlTree, currentRawUrl: this.rawUrlTree, rawUrl, extras, resolve, reject, promise, currentSnapshot: this.routerState.snapshot, currentRouterState: this.routerState }); // Make sure that the error is propagated even though `processNavigations` catch // handler does not rethrow return promise.catch((e) => { return Promise.reject(e); }); } setBrowserUrl(url, replaceUrl, id, state) { const path = this.urlSerializer.serialize(url); state = state || {}; if (this.location.isCurrentPathEqualTo(path) || replaceUrl) { // TODO(jasonaden): Remove first `navigationId` and rely on `ng` namespace. this.location.replaceState(path, '', Object.assign(Object.assign({}, state), { navigationId: id })); } else { this.location.go(path, '', Object.assign(Object.assign({}, state), { navigationId: id })); } } resetStateAndUrl(storedState, storedUrl, rawUrl) { this.routerState = storedState; this.currentUrlTree = storedUrl; this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, rawUrl); this.resetUrlToCurrentUrlTree(); } resetUrlToCurrentUrlTree() { this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', { navigationId: this.lastSuccessfulId }); } } Router.decorators = [ { type: Injectable } ]; Router.ctorParameters = () => [ { type: Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: Location }, { type: Injector }, { type: NgModuleFactoryLoader }, { type: Compiler }, { type: undefined } ]; function validateCommands(commands) { for (let i = 0; i < commands.length; i++) { const cmd = commands[i]; if (cmd == null) { throw new Error(`The requested path contains ${cmd} segment at index ${i}`); } } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvcm91dGVyL3NyYy9yb3V0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLFFBQVEsRUFBQyxNQUFNLGlCQUFpQixDQUFDO0FBQ3pDLE9BQU8sRUFBQyxRQUFRLEVBQUUsVUFBVSxFQUFFLFFBQVEsRUFBRSxTQUFTLEVBQUUscUJBQXFCLEVBQUUsV0FBVyxFQUFFLE1BQU0sRUFBRSxJQUFJLEVBQUUsUUFBUSxJQUFJLE9BQU8sRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUMvSSxPQUFPLEVBQUMsZUFBZSxFQUFFLEtBQUssRUFBYyxFQUFFLEVBQUUsT0FBTyxFQUFlLE1BQU0sTUFBTSxDQUFDO0FBQ25GLE9BQU8sRUFBQyxVQUFVLEVBQUUsTUFBTSxFQUFFLFFBQVEsRUFBRSxHQUFHLEVBQUUsU0FBUyxFQUF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