Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 如何在角路由器的静态URL之间添加参数?_Angular_Angular Router - Fatal编程技术网

Angular 如何在角路由器的静态URL之间添加参数?

Angular 如何在角路由器的静态URL之间添加参数?,angular,angular-router,Angular,Angular Router,我想配置一个类似“name1/:id/name2”的路径并导航到它。如何做到这一点 使用路由器配置 routes = [ {path: 'name1/:id/name2', component: SomeComponent} ] 并通过this.router.navigate(['name1',id,'name2'])或使用元素导航到它 链接使用路由器配置 routes = [ {path: 'name1/:id/name2', component: SomeComponent} ] 并

我想配置一个类似“name1/:id/name2”的路径并导航到它。如何做到这一点

使用路由器配置

routes = [
 {path: 'name1/:id/name2', component: SomeComponent}
]
并通过
this.router.navigate(['name1',id,'name2'])或使用元素导航到它

链接

使用路由器配置

routes = [
 {path: 'name1/:id/name2', component: SomeComponent}
]
并通过
this.router.navigate(['name1',id,'name2'])或使用元素导航到它
链接