本文整理匯總了TypeScript中@ngrx/store.Store.select方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Store.select方法的具體用法?TypeScript Store.select怎麽用?TypeScript Store.select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ngrx/store.Store
的用法示例。
在下文中一共展示了Store.select方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(private store: Store<AppState>) {
this.counter$ = store.select(s => s.counter);
}
示例2: constructor
constructor(private store: Store<fromBooks.State>) {
this.searchQuery$ = store.select(fromBooks.getSearchQuery).take(1);
this.books$ = store.select(fromBooks.getSearchResults);
this.loading$ = store.select(fromBooks.getSearchLoading);
this.error$ = store.select(fromBooks.getSearchError);
}
示例3: constructor
constructor(private http: Http, private store: Store<AppStore>) {
this.items$ = this.store.select(res => res.items);
this.selectedItem$ = this.store.select(res => res.selectedItem);
}
示例4: canActivate
canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
return this.store.select(s => s.user.uid).map(uid => !!uid);
}
示例5: constructor
constructor(private store: Store<Array<Toast2>>) {
store.select('toast2').subscribe((toasts: Toast2[]) => {
this.toasts = toasts;
});
}
示例6: constructor
constructor(private _store: Store<any>, private _http: Http) {
this.user$ = _store.select('user');
}
示例7: constructor
constructor(private store: Store<ApplicationState>) {
this.isCollapsed$ = store.select((state: ApplicationState) => state.containers.collapsableSidebar.isCollapsed);
}
示例8:
public isExpired$(): Observable<boolean> {
return this.store.select(state => state.accounts.session.isExpired);
}
示例9: ngOnInit
public ngOnInit(): void {
this.cartSize$ = this.store
.select('shoppingCart')
.map((items: IShoppingCartItem[]) => items.length)
}