fix(router): expose initalNavigation and dispose so they can be used with webworkers
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
<nav>
|
||||
<ul>
|
||||
<li class="start" [routerLink]="['/Start']">Start</li>
|
||||
<li class="about" [routerLink]="['/About']">About</li>
|
||||
<li class="contact" [routerLink]="['/Contact']">Contact</li>
|
||||
<li class="start" routerLink="/">Start</li>
|
||||
<li class="about" routerLink="/about">About</li>
|
||||
<li class="contact" routerLink="/contact">Contact</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<main>
|
||||
|
@ -6,16 +6,16 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ROUTER_PROVIDERS} from '@angular/router-deprecated';
|
||||
import {provideRouter} from '@angular/router';
|
||||
import {WORKER_APP_LOCATION_PROVIDERS} from '@angular/platform-browser';
|
||||
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
|
||||
|
||||
import {HashLocationStrategy, LocationStrategy} from '@angular/common';
|
||||
import {App} from './index_common';
|
||||
import {App, ROUTES} from './index_common';
|
||||
|
||||
export function main() {
|
||||
bootstrapWorkerApp(App, [
|
||||
ROUTER_PROVIDERS,
|
||||
provideRouter(ROUTES),
|
||||
WORKER_APP_LOCATION_PROVIDERS,
|
||||
{provide: LocationStrategy, useClass: HashLocationStrategy}
|
||||
]);
|
||||
|
@ -10,13 +10,18 @@ import {Component} from '@angular/core';
|
||||
import {Start} from './components/start';
|
||||
import {About} from './components/about';
|
||||
import {Contact} from './components/contact';
|
||||
import {ROUTER_DIRECTIVES, RouteConfig, Route} from '@angular/router-deprecated';
|
||||
import {ROUTER_DIRECTIVES, Router} from '@angular/router';
|
||||
|
||||
@Component({selector: 'app', directives: [ROUTER_DIRECTIVES], templateUrl: 'app.html'})
|
||||
@RouteConfig([
|
||||
new Route({path: '/', component: Start, name: "Start"}),
|
||||
new Route({path: '/contact', component: Contact, name: "Contact"}),
|
||||
new Route({path: '/about', component: About, name: "About"})
|
||||
])
|
||||
export class App {
|
||||
constructor(router: Router) {
|
||||
// this should not be required once web worker bootstrap method can use modules
|
||||
router.initialNavigation();
|
||||
}
|
||||
}
|
||||
|
||||
export const ROUTES = [
|
||||
{path: '', component: Start},
|
||||
{path: 'contact', component: Contact},
|
||||
{path: 'about', component: About}
|
||||
];
|
@ -16,7 +16,7 @@ System.config({
|
||||
'@angular/common': {main: 'index.js', defaultExtension: 'js'},
|
||||
'@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'},
|
||||
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'},
|
||||
'@angular/router-deprecated': {main: 'index.js', defaultExtension: 'js'},
|
||||
'@angular/router': {main: 'index.js', defaultExtension: 'js'},
|
||||
'rxjs': {
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
|
Reference in New Issue
Block a user