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


TypeScript NgRedux.dispatch方法代碼示例

本文整理匯總了TypeScript中@angular-redux/store.NgRedux.dispatch方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript NgRedux.dispatch方法的具體用法?TypeScript NgRedux.dispatch怎麽用?TypeScript NgRedux.dispatch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular-redux/store.NgRedux的用法示例。


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

示例1: logout

 logout() {
   this.ngRedux.dispatch({type: 'RESET_BOARD_STORE'});
   this.ngRedux.dispatch({type: 'RESET_USER_STORE'});
   this.ngRedux.dispatch({type: 'RESET_CARD_STORE'});
   this.ngRedux.dispatch({type: 'RESET_LIST_STORE'});
   this.ngRedux.dispatch({type: 'REMOVE_BOARD_PREFERENCES'});
   localStorage.removeItem('token');
   this.router.navigate(['/start']);
 }
開發者ID:w11k,項目名稱:calendar-for-trello,代碼行數:9,代碼來源:trello-auth.service.ts

示例2:

          this.userRef.valueChanges().subscribe((u: IUser) => {
            if(u) {
              this.user = u;
              this.user.userId = this.userId;

              let cats = !this.user.categories ? [] : this.user.categories;

              this.ngRedux.dispatch({type: Actions.LOAD_USER, user: this.user});
              this.ngRedux.dispatch({type: Actions.LOAD_CATEGORIES, categories: cats});
            }
          });          
開發者ID:Leks12lk,項目名稱:ng5-lib-note,代碼行數:11,代碼來源:user.service.ts

示例3: getCourses

  getCourses() {
    let coursesFetchedData: ICourse[] = [
      {
        id: 1,
        name: 'Learning Flux',
        topic: 'Flux',
      },
      {
        id: 2,
        name: 'Learning Angular2',
        topic: 'Angular2',
      },
      {
        id: 3,
        name: 'Using Redux with Angular2',
        topic: 'Angular2',
      }
    ];

    // store.dispatch({
    //   type: 'GET_COURSES_SUCCESS',
    //   coursesFetchedData
    // });

    /* note: in advanced version, this will be its own layer/injectable service - removed from Ng Data/http services */
    this.ngRedux.dispatch({
      type: 'GET_COURSES_SUCCESS',
      coursesFetchedData,
    });

  };
開發者ID:SteveJPalmer,項目名稱:myCode,代碼行數:31,代碼來源:courses.service.ts

示例4: beforeEach

        beforeEach(inject([NgRedux], (store: NgRedux<AppState>) => {
            const action = commandGelungen(
                {type: CommandType.BeginneInventur, payload: {id: '4711'}, meta: {}},
                {status: 200, message: 'OK'})

            store.dispatch(action)
        }))
開發者ID:haschi,項目名稱:dominium,代碼行數:7,代碼來源:inventur.service.spec.ts

示例5: removeCategory

    removeCategory(cat: string) {    
      if (!this.userId) return;
      var index = this.user.categories.indexOf(cat);
      this.user.categories.splice(index, 1);   
      this.userRef.update(this.user)
          .catch(error => console.log(error));
      this.ngRedux.dispatch({type: Actions.REMOVE_CATEGORY, category: cat});

    }
開發者ID:Leks12lk,項目名稱:ng5-lib-note,代碼行數:9,代碼來源:user.service.ts

示例6: addCategory

   addCategory(cat: string)  {           
     if (!this.userId) return;
     this.user.categories = !this.user.categories ? [] : this.user.categories;
     this.user.categories.push(cat);
     this.userRef.update(this.user)
       .catch(error => console.log(error));     
   
     this.ngRedux.dispatch({type: Actions.ADD_CATEGORY, category: cat});
 }
開發者ID:Leks12lk,項目名稱:ng5-lib-note,代碼行數:9,代碼來源:user.service.ts

示例7: fetchResultDispatch

 fetchResultDispatch(total: number) {
   this.ngRedux.dispatch(this.fetchResult(total));
 }
開發者ID:veanyee,項目名稱:store,代碼行數:3,代碼來源:search.actions.ts

示例8: searchDispatch

 searchDispatch(keyword: string) {
   this.ngRedux.dispatch(this.search(keyword));
 }
開發者ID:veanyee,項目名稱:store,代碼行數:3,代碼來源:search.actions.ts

示例9:

 this.photoService.getAllPhotos().subscribe(photos => {
   this.ngRedux.dispatch({
     type: REQUEST_PHOTOS_SUCCESS,
     photos
   })
 }, error => console.log(error));
開發者ID:mrmodise,項目名稱:senepe,代碼行數:6,代碼來源:photos.action.ts

示例10: resetOrder

 resetOrder()  {
   this.ngRedux.dispatch({
     type: RESET_ORDER
   });
 }
開發者ID:SteveJPalmer,項目名稱:myCode,代碼行數:5,代碼來源:order-search.actions.ts


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