【问题标题】:How to update the view after changing the model in Angular2 by using this._router.navigate()如何使用 this._router.navigate() 在 Angular2 中更改模型后更新视图
【发布时间】:2016-08-05 13:00:26
【问题描述】:

我有 2 个页面使用相同的模板,当我从 page2 转到 page1 时,我想使用 this._router.navigate() 重新加载模板。 page2 使用 page1 作为指令,

我想这样做 让链接=“/对比度/”+数字

this._router.navigate(链接)

并且相当于一个window.location.href

我想强制重新加载模板。 谢谢

【问题讨论】:

标签: angularjs-directive angular angular-ui-router


【解决方案1】:

这个问题有点令人困惑,但看起来你的语法可能是错误的。它应该看起来像这样......

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

并确保在 RouterConfig 中定义该路径,例如

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-25
    • 1970-01-01
    • 1970-01-01
    • 2023-04-07
    • 1970-01-01
    • 2016-01-18
    相关资源
    最近更新 更多