将Angle 4升级到7后,商店无法正常工作

时间:2019-05-16 10:38:16

标签: javascript angular typescript

我已将我的应用程序从4角升级到7角 我的ngrx商店模块遇到问题。它在Angular 4上运行正常,但是现在当我升级到最新版本7时,整个应用程序出现了错误。 说

存储类型“ <任何>”上不存在属性“订阅”。

这就是我访问的方式

   this.store
  .select("codeSelectionSession")
  .subscribe((session: TestOrderCodeSelectionSession) => {
    // checks for null and undefined
    if (session == null) {
      this.store.select("testOrder").subscribe((testOrder: TestOrder) => {
        this.codeSelectionSession = new TestOrderCodeSelectionSession();
        this.store.dispatch(
          new SetTestOrderCodeSelectionSession(this.codeSelectionSession)
        );
      });
    } else {
      this.codeSelectionSession = session;
    }
  });

 this.store
  .select("patient")
  .subscribe(data => {
    this.patient = Object.assign({}, this.patient, data);
  });

选择并订阅出现错误

我的商店版本为

"@ngrx/store": "4.1.1",

有人知道如何解决此问题吗? 谢谢

1 个答案:

答案 0 :(得分:2)

您应该将@ ngrx / store和其他依赖项更新为版本7,就像

    "@ngrx/effects": "^7.4.0",
    "@ngrx/router-store": "^7.4.0",
    "@ngrx/store": "^7.4.0",
    "@ngrx/store-devtools": "^7.4.0",
相关问题