【问题标题】:Is this a persist state issue? Ngrx这是一个持续状态问题吗? Ngrx
【发布时间】:2018-07-20 22:48:06
【问题描述】:

当我使用 angular routerLink 导航时,以下代码可以正常工作。

但是,如果我刷新页面,我会得到 undefined 值。

this.sub = this._route.fragment.subscribe((collectionKey: string) => {
       this.store.dispatch( new actions.Select(collectionKey));
       const col = this.store.select(fromStore.getSelectedCollection);
       col.subscribe(collection => this.collection = collection);
       console.log(this.collection)
    });

有没有办法解决这个问题?

【问题讨论】:

  • iMO 嵌套订阅是个定时炸弹
  • 你能详细说明一下吗?

标签: angular ngrx


【解决方案1】:

如果我理解正确的状态不是持久的。这篇文章可以回答你的问题。

Ngrx Strore Resets after browser refresh , How to make the application preserve the state ?

【讨论】:

    猜你喜欢
    • 2018-06-13
    • 1970-01-01
    • 1970-01-01
    • 2011-07-18
    • 1970-01-01
    • 2014-03-31
    • 2020-04-10
    • 1970-01-01
    相关资源
    最近更新 更多