當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Store.select方法代碼示例

本文整理匯總了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);
 }
開發者ID:NathanWalker,項目名稱:ngrx-devtools-nativescript,代碼行數:3,代碼來源:app.component.ts

示例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);
 }
開發者ID:knarfeh,項目名稱:eebookorg,代碼行數:6,代碼來源:search.component.ts

示例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);
 }
開發者ID:kasperbfrank,項目名稱:angular2-redux-starter,代碼行數:4,代碼來源:item.service.ts

示例4: canActivate

 canActivate(
   next: ActivatedRouteSnapshot,
   state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
   return this.store.select(s => s.user.uid).map(uid => !!uid);
 }
開發者ID:ipetrovbg,項目名稱:indexit,代碼行數:5,代碼來源:loggedin.guard.ts

示例5: constructor

 constructor(private store: Store<Array<Toast2>>) {
   store.select('toast2').subscribe((toasts: Toast2[]) => {
     this.toasts = toasts;
   });
 }
開發者ID:dannylagrouw,項目名稱:trivento-angular2-seed,代碼行數:5,代碼來源:Toast2Component.ts

示例6: constructor

 constructor(private _store: Store<any>, private _http: Http) {
   this.user$ = _store.select('user');
 }
開發者ID:hAWKdv,項目名稱:memetube-web,代碼行數:3,代碼來源:user.model.ts

示例7: constructor

 constructor(private store: Store<ApplicationState>) {
     this.isCollapsed$ = store.select((state: ApplicationState) => state.containers.collapsableSidebar.isCollapsed);
 }
開發者ID:FritzH321,項目名稱:winecellar,代碼行數:3,代碼來源:collapsable-sidebar.container.ts

示例8:

 public isExpired$(): Observable<boolean> {
   return this.store.select(state => state.accounts.session.isExpired);
 }
開發者ID:sergio11,項目名稱:instangular,代碼行數:3,代碼來源:login.selector.ts

示例9: ngOnInit

 public ngOnInit(): void {
     this.cartSize$ = this.store
         .select('shoppingCart')
         .map((items: IShoppingCartItem[]) => items.length)
 }
開發者ID:IvanDobrovolsky,項目名稱:angular2-online-store,代碼行數:5,代碼來源:navigation.component.ts


注:本文中的@ngrx/store.Store.select方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。