Ngrx 和 Angular 解析器

Ngrx and Angular Resolver

我在 angular 中遇到 ngrx 和我的解析器问题。我知道问题所在,但找不到解决方案。我正在从我的 ngrx 存储中选择一个帐户并以 take(1) 结束 obs,但是由于 take(1) 它总是采用第一个值,所以当我发出一个新值时解析器没有得到它。有人可以帮助我吗?

resolve(route: ActivatedRouteSnapshot): Observable<Account> {
    const id = this.getParameter(route, 'accountId');

    if (id) {
      this._store.dispatch(AccountsPageActions.loadAccountWithDetails({ accountId: id }));
      return this._store.select(getAccountDetailById(id)).pipe(
        switchMap(account => this._store.select(getAccountError).pipe(
          map(error => {
            if (error instanceof HttpErrorResponse && error.message.includes(id)) {
              this._utilService.showErrorToast('Zugang nicht gefunden');
              this._router.navigateByUrl('/');
            }
            console.log(account);
            return account
          })
        )),
        skipWhile(account => account?.id !== id),
        take(1)
      );
    }

    return null;
  }

编辑: 问题是我在同一路由中触发解析器。 示例:我正在打开一个手风琴项目 --> 重定向到 /account/{accountId1} 如果我打开另一个手风琴项目我需要重定向到 /account/{accountId2} 但解析器没有解析,因为它没有获得新值使用新帐户。

解析器不是我的问题..

angular material mat-tab-accordion

有问题