blob: b47b96bc2f6b9b7b8980df7076577ddfcab53210 [file] [log] [blame]
{"version":3,"file":"upgrade.js","sources":["../../../packages/router/upgrade/src/upgrade.js","../../../packages/router/upgrade/public_api.js","../../../packages/router/upgrade/upgrade.js"],"sourcesContent":["/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport { APP_BOOTSTRAP_LISTENER } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { UpgradeModule } from '@angular/upgrade/static';\n/**\n * \\@whatItDoes Creates an initializer that in addition to setting up the Angular\n * router sets up the ngRoute integration.\n *\n * \\@howToUse\n *\n * ```\n * \\@NgModule({\n * imports: [\n * RouterModule.forRoot(SOME_ROUTES),\n * UpgradeModule\n * ],\n * providers: [\n * RouterUpgradeInitializer\n * ]\n * })\n * export class AppModule {\n * ngDoBootstrap() {}\n * }\n * ```\n *\n * \\@experimental\n */\nexport const /** @type {?} */ RouterUpgradeInitializer = {\n provide: APP_BOOTSTRAP_LISTENER,\n multi: true,\n useFactory: locationSyncBootstrapListener,\n deps: [UpgradeModule]\n};\n/**\n * \\@internal\n * @param {?} ngUpgrade\n * @return {?}\n */\nexport function locationSyncBootstrapListener(ngUpgrade) {\n return () => { setUpLocationSync(ngUpgrade); };\n}\n/**\n * \\@whatItDoes Sets up a location synchronization.\n *\n * History.pushState does not fire onPopState, so the Angular location\n * doesn't detect it. The workaround is to attach a location change listener\n *\n * \\@experimental\n * @param {?} ngUpgrade\n * @return {?}\n */\nexport function setUpLocationSync(ngUpgrade) {\n if (!ngUpgrade.$injector) {\n throw new Error(`\n RouterUpgradeInitializer can be used only after UpgradeModule.bootstrap has been called.\n Remove RouterUpgradeInitializer and call setUpLocationSync after UpgradeModule.bootstrap.\n `);\n }\n const /** @type {?} */ router = ngUpgrade.injector.get(Router);\n const /** @type {?} */ url = document.createElement('a');\n ngUpgrade.$injector.get('$rootScope')\n .$on('$locationChangeStart', (_, next, __) => {\n url.href = next;\n router.navigateByUrl(url.pathname + url.search + url.hash);\n });\n}\n//# sourceMappingURL=upgrade.js.map","/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport { RouterUpgradeInitializer, locationSyncBootstrapListener, setUpLocationSync } from './src/upgrade';\n// This file only reexports content of the `src` folder. Keep it that way.\n//# sourceMappingURL=public_api.js.map","/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\n/**\n * Generated bundle index. Do not edit.\n */\nexport { RouterUpgradeInitializer, locationSyncBootstrapListener, setUpLocationSync } from './public_api';\n//# sourceMappingURL=upgrade.js.map"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;AAWA,AAGA;;;;;;;;;;;;;;;;;;;;;;;AAuBA,AAAO,MAAuB,wBAAwB,GAAG;IACrD,OAAO,EAAE,sBAAsB;IAC/B,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,6BAA6B;IACzC,IAAI,EAAE,CAAC,aAAa,CAAC;CACxB,CAAC;;;;;;AAMF,AAAO,SAAS,6BAA6B,CAAC,SAAS,EAAE;IACrD,OAAO,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;CAClD;;;;;;;;;;;AAWD,AAAO,SAAS,iBAAiB,CAAC,SAAS,EAAE;IACzC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,CAAC;;;MAGnB,CAAC,CAAC,CAAC;KACJ;IACD,uBAAuB,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/D,uBAAuB,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACzD,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC;SAChC,GAAG,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK;QAC9C,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;QAChB,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;KAC9D,CAAC,CAAC;CACN;;AC3ED;;;;;;;;;;;;;;;;AAgBA,AAA2G;0EACjC;;ACjB1E;;;;;;GAMG;;;;"}