我有分离文件路由设置的组件:
import { NgModule } from '@angular/core'; import { Routes,RouterModule } from '@angular/router'; import { Route } from '../core/route.service'; import { extract } from '../core/i18n.service'; import {CalendarThematicPlanComponent} from './calendar-thematic-plan.component'; const routes: Routes = Route.withShell([ { path: 'calendar',component: CalendarThematicPlanComponent } ]); @NgModule({ imports: [RouterModule.forChild(routes)],exports: [RouterModule],providers: [] }) export class CalendarThematicPlanRoutingModule { }
当我输入URL地址时:http:// localhost:4200 / calendar我被重定向到主页.
如何在Angular 2中跟踪路由?
您可以通过
options传递
a second argument:
imports: [ RouterModule.forRoot( routes,{ enableTracing: true } // <-- debugging purposes only ) ]