从appState中选择商店内的商店

时间:2016-12-30 10:47:00

标签: angular typescript rxjs store

我有这样的商店

    {
      rootStore: {
        firstStore: {
          el: false,
          sec: false,
          th: []
        }
      }
    }

如何一次性获得第一个商店(使用一个选择语句),现在我使用

() => (state: Observable<any>) => state.select('rootStore').select('firstStore');

1 个答案:

答案 0 :(得分:3)

您必须使用map

() => (state: Observable<any>) => state.map(store => store.rootStore.firstStore);

作为替代方案,由于select基本上是pluck的别名,因此也适用:

() => (state: Observable<any>) => state.select('rootStore', 'firstStore');
相关问题