本文整理汇总了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)
}