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


TypeScript store.select函數代碼示例

本文整理匯總了TypeScript中@ngrx/store.select函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript select函數的具體用法?TypeScript select怎麽用?TypeScript select使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了select函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: create

    async create(fileChanges: VcsFileChange[]): Promise<VcsItemCreateResult<NoteVcsItemComponent>> {
        const usedFileChanges: VcsFileChange[] = [];
        const refs: VcsItemRef<NoteVcsItemComponent>[] = [];

        // Get notes first.
        const notes = await toPromise(this.store.pipe(
            select(state => state.note.collection.notes),
            pipe(take(1)),
        ));

        for (const note of notes) {
            let index: number;
            const willUseFileChanges: VcsFileChange[] = [];

            // Note file
            index = fileChanges.findIndex(change => change.absoluteFilePath === note.filePath);
            if (index !== -1) {
                willUseFileChanges.push(fileChanges[index]);
            }

            // Note content file
            index = fileChanges.findIndex(change => change.absoluteFilePath === note.contentFilePath);
            if (index !== -1) {
                willUseFileChanges.push(fileChanges[index]);
            }

            if (willUseFileChanges.length > 0) {
                const config: VcsItemConfig = {
                    title: note.title,
                    fileChanges: willUseFileChanges,
                };

                const ref = new VcsItemRef<NoteVcsItemComponent>(config);
                ref.component = NoteVcsItemComponent;

                usedFileChanges.push(...willUseFileChanges);
                refs.push(ref);
            }
        }

        return { refs, usedFileChanges };
    }
開發者ID:suiruiw,項目名稱:geeks-diary,代碼行數:42,代碼來源:note-vcs-item-factory.ts

示例2: hasSkilltree

 hasSkilltree(id: string): Observable<boolean> {
   return this.store.pipe(
     select(state => {
       return {loaded: Reducers.isLoaded(state), skilltrees: Reducers.getSkilltrees(state)};
     }),
     filter((combinedData) => {
       return combinedData.loaded;
     }),
     map(combinedData => {
       return combinedData.skilltrees;
     }),
     map(skilltrees => {
       return !!skilltrees[id];
     }),
     take(1),
     map(hasSkilltree => {
       return hasSkilltree;
     })
   );
 }
開發者ID:xXKeyleXx,項目名稱:MyPet-SkilltreeCreator,代碼行數:20,代碼來源:skilltree-exists.guard.ts

示例3: ngOnInit

 ngOnInit() {
   this.store.dispatch(new GetAppImagesAction());
   this.app$ = this.store.pipe(select(getApp), filterNull());
   this._sub = this.app$.pipe(first()).subscribe(app => this.store.dispatch(new GetQrCodeTemplatesAction({
     appId: app.app_id,
     backendId: app.backend_server,
   })));
   this.imagesInfo$ = this.store.select(getAppImages);
   this.status$ = this.store.select(getAppImagesStatus);
   this.generateStatus$ = this.store.select(getGenerateAppImagesStatus);
   this.generateStatus$.subscribe(status => {
     if (status.success) {
       this.router.navigate([ '../' ], {
         relativeTo: this.route,
         queryParams: {
           reloadImage: true,
         },
       });
     }
   });
 }
開發者ID:our-city-app,項目名稱:plugin-mobicage-control-center,代碼行數:21,代碼來源:generate-images.component.ts

示例4: it

    it('should initialize properly', () => {
      TestBed.configureTestingModule({
        imports: [
          StoreModule.forRoot(reducers, { initialState }),
          StoreModule.forFeature('items', todos, {
            initialState: featureInitialState,
          }),
        ],
      });

      const store: Store<any> = TestBed.get(Store);

      let expected = [
        {
          todos: initialState.todos,
          visibilityFilter: initialState.visibilityFilter,
          items: featureInitialState,
        },
      ];

      store.pipe(select(state => state)).subscribe(state => {
        expect(state).toEqual(expected.shift());
      });
    });
開發者ID:AlexChar,項目名稱:platform,代碼行數:24,代碼來源:integration.spec.ts

示例5: constructor

 /**
  * Constructor
  *
  * @param {ChangeDetectorRef} _changeDetectorRef
  * @param {FuseSidebarService} _fuseSidebarService
  * @param {FuseTranslationLoaderService} _fuseTranslationLoaderService
  * @param {MailNgrxService} _mailNgrxService
  * @param {Store<MailAppState>} _store
  */
 constructor(
     private _changeDetectorRef: ChangeDetectorRef,
     private _fuseSidebarService: FuseSidebarService,
     private _fuseTranslationLoaderService: FuseTranslationLoaderService,
     private _mailNgrxService: MailNgrxService,
     private _store: Store<fromStore.MailAppState>
 )
 {
     // Set the defaults
     this.searchInput = new FormControl('');
     this._fuseTranslationLoaderService.loadTranslations(english, turkish);
     this.currentMail$ = this._store.pipe(select(fromStore.getCurrentMail));
     this.mails$ = this._store.pipe(select(fromStore.getMailsArr));
     this.folders$ = this._store.pipe(select(fromStore.getFoldersArr));
     this.labels$ = this._store.pipe(select(fromStore.getLabelsArr));
     this.selectedMailIds$ = this._store.pipe(select(fromStore.getSelectedMailIds));
     this.searchText$ = this._store.pipe(select(fromStore.getSearchText));
     this.mails = [];
     this.selectedMailIds = [];
 }
開發者ID:karthik12ui,項目名稱:fuse-angular-full,代碼行數:29,代碼來源:mail.component.ts

示例6: resolve

	resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Item> {
		this.store.dispatch(new FindOneAction(route.params.id, route.params.podcastId));

		return this.store.pipe(select(item), skip(1), take(1));
	}
開發者ID:davinkevin,項目名稱:Podcast-Server,代碼行數:5,代碼來源:item.resolver.ts

示例7: ngOnInit

 ngOnInit() {
   this.chartDetails$ = this.store.pipe(select(selectAppDetails));
 }
開發者ID:supergiant,項目名稱:supergiant,代碼行數:3,代碼來源:app-details.component.ts

示例8: constructor

 constructor(private store: Store<fromBooks.State>) {
   this.book$ = store.pipe(select(fromBooks.getSelectedBook));
   this.isSelectedBookInCollection$ = store.pipe(
     select(fromBooks.isSelectedBookInCollection)
   );
 }
開發者ID:WinGood,項目名稱:platform,代碼行數:6,代碼來源:selected-book-page.ts

示例9: getLinkTypes

 get getLinkTypes(): Observable<LinkTypeUI[]> {
   return this.store.pipe(
     select(workItemDetailSelector),
     select(state => state.linkType),
     filter(lt => !!lt.length));
 }
開發者ID:joshuawilson,項目名稱:almighty-ui,代碼行數:6,代碼來源:link-type.ts

示例10: constructor

 constructor(private store: Store<fromRoot.State>) {
     this.article$ = store.pipe(select(fromArticles.getSelectedArticle));
 }
開發者ID:evcraddock,項目名稱:erikvancraddock.com,代碼行數:3,代碼來源:article-detail.component.ts


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