搜索后解决它可能对其他人有帮助,作为答案发布-
错误Invalid number of '../'的解决方法
您需要导入 RouteSegment 并将其添加到您的构造函数中
import { Router, RouteSegment } from '@angular/router';
...
contructor(private $_router:Router, private $_segment:RouteSegment){}
...
//If you are in for example child1 and child 1 is sibling of child2
this.$_router.navigate(['../child2'],this.$_segment);
Credit goes to this answer
angular2 RC 中的子路由
没有什么/... 像在 angular2 beta 中指定有子路由,你只需要声明路由就不需要使用这个/...
Routerparams 在 angular2 RC.1 中不起作用
现在RouteParams 已更改为RouteSegment,因此您必须将RouteSegment 引入构造函数并获取这样的参数 -
constructor(params: RouteSegment) {
let id = params.getParam("params_name");
}