Some recommendations can be found in the ngrx app. There is a pattern in which selectors are defined next to the gears :
export function getBookEntities() { return (state$: Observable<BooksState>) => state$ .select(s => s.entities); };
And these selectors are used in (smart) components to select / filter state:
... export class CollectionPage { books$: Observable<BooksInput>; constructor(store: Store<AppState>) { this.books$ = store.let(getBookCollection()); } }
This template / mechanism can be used to filter state in components or services - depending on what suits your architecture best.
source share