Bazı yönergelikler ngrx example application'da bulunabilir. Orada seçiciler alongside reducers tanımlandığı gibi olduğu bir kalıptır:
/**
* Because the data structure is defined within the reducer it is optimal to
* locate our selector functions at this level. If store is to be thought of
* as a database, and reducers the tables, selectors can be considered the
* queries into said database. Remember to keep your selectors small and
* focused so they can be combined and composed to fit each particular
* use-case.
*/
export function getBookEntities() {
return (state$: Observable<BooksState>) => state$
.select(s => s.entities);
};
ve bu seçiciler durum filtre/seçmek için used in (smart) components şunlardır:
...
export class CollectionPage {
books$: Observable<BooksInput>;
constructor(store: Store<AppState>) {
this.books$ = store.let(getBookCollection());
}
}
Bu model/mekanizması durumunu filtre kullanılabilir
ya Bileşenler veya hizmetler - mimarinize en uygun olanı seçin.
Tamam, açıklama için teşekkürler – user3253156