/** * @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 { APP_BOOTSTRAP_LISTENER } from '@angular/core'; import { Router } from '@angular/router'; import { UpgradeModule } from '@angular/upgrade/static'; /** * Creates an initializer that sets up `ngRoute` integration * along with setting up the Angular router. * * @usageNotes * * * @NgModule({ * imports: [ * RouterModule.forRoot(SOME_ROUTES), * UpgradeModule * ], * providers: [ * RouterUpgradeInitializer * ] * }) * export class AppModule { * ngDoBootstrap() {} * } * * * @publicApi */ export const RouterUpgradeInitializer = { provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: locationSyncBootstrapListener, deps: [UpgradeModule] }; /** * @internal */ export function locationSyncBootstrapListener(ngUpgrade) { return () => { setUpLocationSync(ngUpgrade); }; } /** * Sets up a location change listener to trigger `history.pushState`. * Works around the problem that `onPopState` does not trigger `history.pushState`. * Must be called *after* calling `UpgradeModule.bootstrap`. * * @param ngUpgrade The upgrade NgModule. * @param urlType The location strategy. * @see {@link HashLocationStrategy} * @see {@link PathLocationStrategy} * * @publicApi */ export function setUpLocationSync(ngUpgrade, urlType = 'path') { if (!ngUpgrade.$injector) { throw new Error(` RouterUpgradeInitializer can be used only after UpgradeModule.bootstrap has been called. Remove RouterUpgradeInitializer and call setUpLocationSync after UpgradeModule.bootstrap. `); } const router = ngUpgrade.injector.get(Router); const location = ngUpgrade.injector.get(Location); ngUpgrade.$injector.get('$rootScope') .$on('$locationChangeStart', (event, newUrl, oldUrl, newState, oldState) => { // Navigations coming from Angular router have a navigationId state // property. Don't trigger Angular router navigation again if it is // caused by a URL change from the current Angular router // navigation. const currentNavigationId = router.getCurrentNavigation()?.id; const newStateNavigationId = newState?.navigationId; if (newStateNavigationId !== undefined && newStateNavigationId === currentNavigationId) { return; } let url; if (urlType === 'path') { url = resolveUrl(newUrl); } else if (urlType === 'hash') { // Remove the first hash from the URL const hashIdx = newUrl.indexOf('#'); url = resolveUrl(newUrl.substring(0, hashIdx) + newUrl.substring(hashIdx + 1)); } else { throw 'Invalid URLType passed to setUpLocationSync: ' + urlType; } const path = location.normalize(url.pathname); router.navigateByUrl(path + url.search + url.hash); }); } /** * Normalizes and parses a URL. * * - Normalizing means that a relative URL will be resolved into an absolute URL in the context of * the application document. * - Parsing means that the anchor's `protocol`, `hostname`, `port`, `pathname` and related * properties are all populated to reflect the normalized URL. * * While this approach has wide compatibility, it doesn't work as expected on IE. On IE, normalizing * happens similar to other browsers, but the parsed components will not be set. (E.g. if you assign * `a.href = 'foo'`, then `a.protocol`, `a.host`, etc. will not be correctly updated.) * We work around that by performing the parsing in a 2nd step by taking a previously normalized URL * and assigning it again. This correctly populates all properties. * * See * https://github.com/angular/angular.js/blob/2c7400e7d07b0f6cec1817dab40b9250ce8ebce6/src/ng/urlUtils.js#L26-L33 * for more info. */ let anchor; function resolveUrl(url) { if (!anchor) { anchor = document.createElement('a'); } anchor.setAttribute('href', url); anchor.setAttribute('href', anchor.href); return { // IE does not start `pathname` with `/` like other browsers. pathname: `/${anchor.pathname.replace(/^\//, '')}`, search: anchor.search, hash: anchor.hash }; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXBncmFkZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3JvdXRlci91cGdyYWRlL3NyYy91cGdyYWRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFBQyxRQUFRLEVBQUMsTUFBTSxpQkFBaUIsQ0FBQztBQUN6QyxPQUFPLEVBQUMsc0JBQXNCLEVBQStCLE1BQU0sZUFBZSxDQUFDO0FBQ25GLE9BQU8sRUFBQyxNQUFNLEVBQWtDLE1BQU0saUJBQWlCLENBQUM7QUFDeEUsT0FBTyxFQUFDLGFBQWEsRUFBQyxNQU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