0
子單元想用孩子模塊
const routes: Routes = [
{ path: '', component: ProcComponent,
children:[{
path: '/LoadProcResultsdata/:procResults', component: ProcResultsComponent,
}]
}
];
App.Module.ts從一個頁面導航到另一個頁面
const routes: Routes = [
{ path: 'app', component: AppComponent },
{ path: 'home', component: HomeComponent },
{ path: 'treeview', component: TreeViewComponent },
{path:'Proc', loadChildren:'app/proc/Proc.Module#ProcModule'}
]。
我的代碼
this.router.navigate(['/LoadProcResultsdata/'],{ queryParams: { procResults:this.results } });
但我得到下面的錯誤。
core.umd.js:3064 EXCEPTION:未捕獲(承諾):錯誤:無法匹配任何路由。 URL段:'LoadProcResultsdata' 錯誤:無法匹配任何路由。 URL段:「LoadProcResultsdata」
謝謝四位迴應。 this.results是一組字符串,我想通過不同的頁面。有沒有更好的方法將字符串或數組傳送到不同的頁面。 – Venu
@Venu,當然你可以使用queryparams傳遞數組,我已經更新了我的答案,並且還添加了示例Plunker,Cheers! –
我嘗試了沒有參數,但仍然給出了相同的錯誤。, – Venu