我正在尝试将rc5用于路线。
这是我想要做的。
这是我的app.routes.ts
const routeConfig: Routes = [
{ path: '', component: LoginComponent},
{ path: 'login', component: LoginComponent},
{ path: 'dashboard', component: DashboardComponent},
{path: 'models',component: ModelsComponent, outlet:'content'}
];
// - Updated Export
export const routing = RouterModule.forRoot(routeConfig);
以下是仪表板的html:
<div>
<div class="dashhead">
<div class="dashhead-titles">
<h6 class="dashhead-subtitle">Qauntitative Treasury Analytics</h6>
<h3 class="dashhead-title">QTA Model Builder</h3>
</div>
<div class="dashhead-toolbar">
<span class="dashhead-toolbar-divider hidden-xs"></span>
</div>
</div>
<ul class="nav nav-bordered">
<li [class.active]="isCurrentRoute(['models'])"><a [routerLinkActive]="['active']" [routerLink]="['models']">Models</a></li>
<li><a (click)="logout()">Logout</a></li>
</ul>
</div>
<router-outlet name="content"></router-outlet>
单击导航中的模型链接时出现错误:
core.umd.js:5995 EXCEPTION: Uncaught (in promise): Error: Cannot match any routes: 'dashboard/models'
答案 0 :(得分:0)
你应该试试
addDrugTxt
而不是:
routerLink='/home'