あなたはimport { RouterModule, Routes } from '@angular/router';
になりますと、あなたはあなたのapp.ts
またはmain.ts
に以下のようにあなたのルートを宣言しなければならないだろう。
const routes: Routes = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'dashboard', component: DashboardComponent },
];
@NgModule({
imports: [ RouterModule.forRoot(routes) ],
exports: [ RouterModule ]
})
その後、あなたは以下のようなあなたの対応するコンポーネントにroutes
を使用することができます。
this.router.navigate(['/dashboard']);
新しいfunction
を追加:
gotoDashBoard() {
console.log("coming");
console.log(this);
this.router.navigate(['/dashboard']);
}
とcall
これはあなたのresponse => {this.gotoCrises()}
にあります。
ルーティングコンポーネントも転記してください。エラーはそのルートが見つからないことを示しています。 –