引导

既然已经定义了路由,我们需要让我们的应用程序了解路由。为此,请引导我们在上一个示例中导出的提供程序。

找到你的 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));