我试图通过ts代码使用路由,但是我在使用参数时遇到了麻烦。
onSubmit(s) {
this.router.navigate(['/search', {string: 'mulher'} ]) ;
}
路线
export const ROUTES: Routes = [
{path: '', component: AppComponent,
children: [
{ path: '', redirectTo: 'home', pathMatch: 'full'},
{ path: 'home', component: HomeComponent },
{ path: 'categoria/:id', component: ListaComponent },
{ path: 'player/:id', component: PlayerComponent },
{ path: 'search/:string', component: SearchComponent }]
}]
core.es5.js:1020 ERROR错误:未捕获(在承诺中):错误:无法 匹配任何路线。网址细分:'搜索;字符串= mulher'错误:不能 匹配任何路线。网址细分:'搜索;字符串= mulher'
答案 0 :(得分:1)
您可以简单地使用:
while x >= zero