當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。