当前位置: 首页>>代码示例>>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;未经允许,请勿转载。