2016-08-05 268 views
1

改变Angular2模型后更新视图我有2页谁使用相同的模板,我希望当我从第2页去使用这PAGE1重新加载模板._router.navigate()。 的第2页使用第1页作为指令,如何使用this._router.navigate()

我想这样做 设链接= “/ contrat /” + NUM

this._router.navigate(链接)

和相当于一个window.location.href

我想迫使模板重新加载。 感谢的

+0

貌似http://stackoverflow.com/questions/的DUP 38786246/angular2-componentrouter-防止自动组分复用/ 38786303#38786303 –

+0

请张贴演示你试图完成什么的代码。 –

+0

我添加的代码解释 – imtah

回答

1

这个问题是有点混乱,但它看起来像你的语法可能是错误的。它应该是这个样子......

this.router.navigate(['page2']); 

,并确保你定义一个RouterConfig内的路径,例如

{path: 'page2', component: page2Component},