2017-06-25 9 views
0

examplereselect createSelectorstore.selectメソッドを使用せずにngrxストアから状態を取得する方法はありますか?どのように再選択ライブラリなしでngrxストアから状態を取得するには?

export const getBookCollection = createSelector(getBookEntities, getCollectionBookIds, (entities, ids) => { return ids.map(id => entities[id]); });

constructor(store: Store<fromRoot.State>) { this.books$ = store.select(fromRoot.getBookCollection); }

+0

なぜあなたはstore.selectを使用したくないでしょうか? – pixelbits

答えて

1

あなたができるだけstore.selectを使用する:

export const getBooksCollection = (state: State) => { 
    const ids = state.collection.ids; 
    const entities = state.books.entities; 
    return ids.map(id => entities[id]); 
} 

constructor(store: Store<fromRoot.State>) { 
    this.books$ = store.select(fromRoot.getBookCollection); 
} 
関連する問題