当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript angular2-toaster.ToasterService类代码示例

本文整理汇总了TypeScript中angular2-toaster.ToasterService的典型用法代码示例。如果您正苦于以下问题:TypeScript ToasterService类的具体用法?TypeScript ToasterService怎么用?TypeScript ToasterService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ToasterService类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

 () => {
     this.toaster.pop(
         'success',
         'Message Sent',
         'Your message has been sent. Someone will get back to you at the earliest opportunity.'
     );
 }
开发者ID:finleysg,项目名称:bhmc,代码行数:7,代码来源:contact.component.ts

示例2: canActivate

  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
    if (!this.authorizationService.getPayload) {
      this.toasterService.pop('warning', 'Unauthorized Access', 'Please login');

      this.router.navigate(['/login'], { queryParams : { return: state.url } });
      
      return false;
    }

    if (!this.authorizationService.getActivePayload) {
      this.authorizationService.deleteToken();
      
      this.toasterService.pop('warning', 'Your Session has Expired', 'Please login');

      this.router.navigate(['/login'], { queryParams : { return: state.url } });
      
      return false;
    }

    if (state.url === '/administration/manage-players' || state.url === '/administration/manage-coaches') {
      if (!this.authorizationService.getActivePayload.userProfile.isAdministrator) {
        this.toasterService.pop('warning', 'Unauthorized Access', 'Administrator access only');

        this.router.navigate(['/groups']);

        return false;
      }
    }
    else {
      if (/^\/players\/(?:[^%]|%[0-9A-Fa-f]{2})+\/2[0-9]{3}$/.test(state.url)) {
        let userProfile: IUserProfile = this.authorizationService.getActivePayload.userProfile;

        if (!userProfile.isAdministrator) { 
          if (!(userProfile.isManager && userProfile.groups.find(group => group === +route.url[2].path))) {
            this.toasterService.pop('warning', 'Unauthorized Access', 'Group Manager access only');

            this.router.navigate(['/groups']);
    
            return false;  
          }
        }
      }
    }

    return true;
  }
开发者ID:emmettos,项目名称:CarraigOgRegister,代码行数:46,代码来源:authorization.guard.ts

示例3:

 .then((nbr: number) => {
     if (nbr > 0) {
         this.eventService.refreshEventDetail().then(() => {
             this.toaster.pop('success', 'Groups Added', `${nbr} additional groups were added to the event`);
         });
     } else {
         this.toaster.pop('warning', 'No Groups Added', 'No additional groups were added to the event. Are the par 3s already full?');
     }
 })
开发者ID:finleysg,项目名称:bhmc,代码行数:9,代码来源:event.component.ts

示例4: canActivate

  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
    if (this.authorizationService.getActivePayload) {
      this.toasterService.pop('success', 'Active Session Found', 'Redirecting to Home');
      
      this.router.navigate(['/groups']);

      return false;
    }

    return true;
  }
开发者ID:emmettos,项目名称:CarraigOgRegister,代码行数:11,代码来源:login.guard.ts

示例5: showNotification

    showNotification(type: MessageType, title: string, message: string, icon?: string): void {

        switch (+type) {
            case MessageType.Error:
                this.toasterService.pop('error', title, message);
                break;

            case MessageType.Info:
                this.toasterService.pop('info', title, message);
                break;

            case MessageType.Wait:
                this.toasterService.pop('wait', title, message);
                break;

            case MessageType.Success:
                this.toasterService.pop('success', title, message);
                break;

            case MessageType.Warning:
                this.toasterService.pop('warning', title, message);
                break;
            default:
                this.toasterService.pop('info', 'Whut?', 'Can not get message type');
        }
    }
开发者ID:esarachik,项目名称:apirestmongo,代码行数:26,代码来源:webAndMobileNotification.service.ts

示例6: if

 return next.handle(request).pipe(catchError(err => {
     if (err.status === 401 && err.error==null) {
         this.toasterService.pop('error','','Session Expired.');
         this.authenticationService.logout();
         location.reload(true);
     }
     else if(err.status === 403 && err.error==null){
         this.toasterService.pop('error','','You are not authroized.');   
     }
     else if(err.status === 500 && err.error==null){
         this.toasterService.pop('error','','Internal Server Error.');  
     }
     else if(err.error)
     {
         this.toasterService.pop('error','',err.error.Message)
     }
     else 
     {
      this.toasterService.pop('error','','Something went wrong. Please try again later.');
     }
     return throwError(err);
 }))
开发者ID:Ejeus,项目名称:PPM,代码行数:22,代码来源:error.interceptor.ts

示例7:

        error: (error: any) => {
          if (error instanceof HttpErrorResponse) {
            let router: Router = this.injector.get(Router);

            console.error('HTTP error Response received at [' + router.url + ']:', error);

            if (error.status === 401) {
              if (error.url.indexOf('api/authenticate') === -1 && error.url.indexOf('api/writeLog') === -1 
                  && error.url.indexOf('api/verifyUserToken') === -1) {
                // These conditions should never occur because they will be caught in the route gaurds.
                // Leaving them here though just in case (IE. someone could have hacked the JSON Web Token).
                if (this.authorizationService.getPayload) {
                  if(!this.authorizationService.getActivePayload) {
                    this.authorizationService.deleteToken();
                    
                    this.toasterService.pop('warning', 'Your session has Expired', 'Please login');

                    router.navigate(['/login']);
                  }
                  else {
                    this.toasterService.pop('warning', 'Unauthorized Access', 'Permission denied');

                    router.navigate(['/groups']);    
                  }
                }
                else {
                  this.toasterService.pop('warning', 'Unauthorized Access', 'Please login');

                  router.navigate(['/login']);
                }
              }
            }
            else {
              let alertService: AlertService = this.injector.get(AlertService);

              alertService.error(error.message, error.error.error ? error.error.error.message: "");
            }
          }
        }
开发者ID:emmettos,项目名称:CarraigOgRegister,代码行数:39,代码来源:http.interceptor.helper.ts

示例8: registerOnline

 registerOnline(): void {
     if (!this.registrationGroup.registrations[0].isNetSkinsFeePaid && !this.registrationGroup.registrations[0].isGrossSkinsFeePaid) {
         this.toaster.pop('warning', 'Invalid', 'Select the scratch or flighted bracket.');
         return;
     }
     this.registrationService.reserve(this.eventDetail.id)
         .then(() => {
             // preserve the registration choices made
             let group = this.registrationService.currentGroup;
             let registration = _.merge({}, group.registrations[0], this.registrationGroup.registrations[0]);
             this.paymentGroup = _.merge({}, group, this.registrationGroup);
             this.paymentGroup.registrations[0] = registration;
             this.updatePayment();
             this.paymentComponent.open();
         })
         .catch((err: string) => {
             this.toaster.pop('error', 'Error', err);
         });
 }
开发者ID:finleysg,项目名称:bhmc,代码行数:19,代码来源:matchplay-signup.component.ts

示例9: handleError

 handleError(error) {
    this.toasterService.pop('error',error.statusText,error.message);
    // IMPORTANT: Rethrow the error otherwise it gets swallowed
    throw error;
 }
开发者ID:Ejeus,项目名称:PPM,代码行数:5,代码来源:GlobalErrorHandler.ts


注:本文中的angular2-toaster.ToasterService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。