引導

既然已經定義了路由,我們需要讓我們的應用程式瞭解路由。為此,請引導我們在上一個示例中匯出的提供程式。

找到你的 bootstrap 配置(應該在 main.ts,但你的里程可能會有所不同 )。

//main.ts

import {bootstrap} from '@angular/platform-browser-dynamic';

//Import the App component (root component)
import { App } from './app/app';

//Also import the app routes
import { APP_ROUTES_PROVIDER } from './app/app.routes';

bootstrap(App, [
  APP_ROUTES_PROVIDER,
])
.catch(err => console.error(err));