• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript angular2-toaster.ToasterService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript angular2-toaster.ToasterService类代码示例发布时间:2022-05-28
下一篇:
TypeScript angular2-toaster.ToasterModule类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap