我的RouteConfig定义了以下路径
@RouteConfig ([ { path:'/main',name:'Home',redirectTo: ['Setup']},{ path:'/setup',name:'Setup',component:SetupComponent},{ path:'/configuration',name:'Configuration',component:ConfigurationComponent},])
在我的模板中
<ol> <li><a [routerLink]="['Setup']">Setup</a></li> <li><a [routerLink]="['Configuration']">Configuration</a></li> <li><a [routerLink]="['Home']">Home</a></li> </ol>
在组件中,我尝试过一种方法
this._Router.navigate(['Home']);
在这两种情况下,(使用routerLink指令和Router.navigate方法)在尝试导航到“Home”路由时,我收到以下错误.
Component "AppComponent" has no route named "Home"
而具有与其关联的组件的路线都按预期工作.从Children路由器调用它们时的行为也是如此.
如何路由/导航到名为“Home”的路由?