Angular2,相对导航(向后两级../../)

use*_*019 2 navigation routing angular

我的应用程序中有一个后退按钮,可以向后导航一些级别。如果是一级

this.router.navigate(['..'], { relativeTo: this.route });
Run Code Online (Sandbox Code Playgroud)

效果很好(生成的路由网址:)http://localhost:3000/three/two/one。在两级后退的情况下。导航

this.router.navigate(['..', '..'], { relativeTo: this.route });
Run Code Online (Sandbox Code Playgroud)

路由器向后导航两个级别,但生成的路由网址现在看起来像http://localhost:3000/three/two/(尾部斜杠,这是不正确的)。

我是在做错什么还是可能是错误?

Rob*_*hof 6

如果降低两个级别,请使用以下命令:

this.router.navigate(['../../'], { relativeTo: this.route });
Run Code Online (Sandbox Code Playgroud)