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


TypeScript ToastsManager.error方法代码示例

本文整理汇总了TypeScript中ng2-toastr.ToastsManager.error方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ToastsManager.error方法的具体用法?TypeScript ToastsManager.error怎么用?TypeScript ToastsManager.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ng2-toastr.ToastsManager的用法示例。


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

示例1:

 }, error => {
   if (error.status === 401) {
     this._toastr.error('Невозможно войти с предоставленными данными', 'Ошибка!');
   } else {
     this._toastr.error('Что-то пошло не так', 'Ошибка!');
   }
 });
开发者ID:asiman161,项目名称:easy-tests,代码行数:7,代码来源:sign-in.component.ts

示例2: showError

 showError(ngToast: ToastsManager, objError, status){
     if(objError !== null && typeof objError === 'object')
     {
         if('error_description' in objError)
             ngToast.error(objError.error_description, 'Ops!');
         else if('message' in objError){
             if(status == 401 || status === undefined){
                 if(objError.message !== 'Authorization has been denied for this request.')
                     ngToast.error(objError.message, 'Ops!');
                 else{
                     ngToast.error('Sua sessão expirou ou o acesso foi negado. Faça o login novamente.', 'Ops!');
                     this.sessionService.logout();
                     this.router.navigate(['/login']);
                 }
             }
             else
                 ngToast.error(objError.message, 'Ops!');
         }
         else
             ngToast.error(objError, 'Ops!');
     }
     else{
         if(typeof objError === 'string')
             ngToast.error(objError, 'Ops!');
         else if(objError === null && status == -1)
             ngToast.error('Não foi possível conectar-se ao servidor.', 'Ops!');
         else
             ngToast.error('Ocorreu um erro ao realizar esta operação. Contate o suporte.', 'Ops!');
     }
 }
开发者ID:PauloRobertoMoraesCosta,项目名称:Garcom,代码行数:30,代码来源:help.ts

示例3: toastSetupError

 /*
  * Displays an error at setup
  */
 toastSetupError(code :number)
 {
   let key: string;
   switch(code)
   {
     case 1:
       key = 'TOASTR.SETUP.SQLERROR';
       break;
     case 2:
       key = 'TOASTR.SETUP.PATHERROR';
       break;
     case 4:
       key = 'TOASTR.SETUP.USERERROR';
       break;
     case 5:
       key = 'TOASTR.SETUP.USERERROR';
       break;
     case 6:
       key = 'TOASTR.SETUP.SETERROR';
       break;
     default:
       key = 'TOASTR.ERROR.DEFAULT';
   }
   let message: string
   this.translateService.get(key).subscribe(
     value => {
       message = value;
     });
   this.toastr.error(message);
 }
开发者ID:jodogne,项目名称:orthanc-explorer-2,代码行数:33,代码来源:app.component.ts

示例4: interceptAfter

    public interceptAfter(interceptedResponse: InterceptedResponse): InterceptedResponse {
        if (!interceptedResponse.response.ok && interceptedResponse.response.status !== 401) {
            const errorMessage = interceptedResponse.response.json().error ||
                                 interceptedResponse.response.statusText;
            this.toastr.error(errorMessage);
        }

        return interceptedResponse;
    }
开发者ID:RomanFrom710,项目名称:lunch-time,代码行数:9,代码来源:error-handling.interceptor.ts

示例5:

        return this.http.get(verifyLink).map(response => {
            const isValidToken = !!response.text();

            if (!isValidToken) {
                this.toastr.error('Неверный верификационный код');
                this.router.navigate(['/']);
            }

            return isValidToken;
        });
开发者ID:RomanFrom710,项目名称:lunch-time,代码行数:10,代码来源:register-guard.service.ts

示例6: fbCallback

  fbCallback(message: string, result: any) {

    console.log('LoginComponent: fbCallback --> result ' + JSON.stringify(result));

    if (message === null) {
      this.router.navigate(['/ticket']);

    } else {
      this.toastr.error(message, 'Error!');
    }
  }
开发者ID:BruceCutler,项目名称:aws-serverless-workshops,代码行数:11,代码来源:login.component.ts

示例7: leftFeedback

 leftFeedback() {
   if (this.feedbackForm.valid) {
     this._feedbackService.leftFeedback(this.feedbackForm.value).subscribe(() => {
       this._toastr.success('Отзыв успешно отправлен', 'Успешно!');
       this._router.navigateByUrl('/');
     }, error => {
       this._toastr.error('Что-то пошло не так', 'Ошибка!');
     });
   } else {
     this._toastr.error('В форме присутствуют ошибки\nУбедитесь, что все поля заполненны верно', 'Ошибка!');
   }
 }
开发者ID:asiman161,项目名称:easy-tests,代码行数:12,代码来源:feedback.component.ts

示例8: signUp

 signUp() {
   const equalPasswords = this.signUpForm.controls.password.value === this.signUpForm.controls.confirmPassword.value;
   if (this.signUpForm.valid && equalPasswords) {
     this._tokenService.registerAccount(
       this.signUpForm.value.email,
       this.signUpForm.value.password,
       this.signUpForm.value.confirmPassword
     ).subscribe(res => {
         this.router.navigateByUrl('');
       },
       error => {
         this._toastr.error('Что-то пошло не так', 'Ошибка!');
       });
   } else {
     this._toastr.error('Убедитесь, что все поля заполнены верно', 'Ошибка!');
   }
 }
开发者ID:asiman161,项目名称:easy-tests,代码行数:17,代码来源:sign-up.component.ts

示例9: switch

 .catch((resp) => {
   if (resp instanceof HttpErrorResponse) {
     switch (resp.status) {
       case 404:
         this.router.navigate(['/404']);
         break;
       case 401:
         this.authStorageService.remove();
         this.router.navigate(['/login']);
         // falls through
       default:
         this.toastr.error(resp.error.detail || '',
           `${resp.status} - ${resp.statusText}`);
     }
   }
   // Return the error to the method that called it.
   return Observable.throw(resp);
 });
开发者ID:mkoderer,项目名称:ceph,代码行数:18,代码来源:auth-interceptor.service.ts

示例10: onClick

  @HostListener('click')
  onClick() {
    try {
      // Create the input to hold our text.
      const tmpInputElement = document.createElement('input');
      tmpInputElement.value = this.getInputElement().value;
      document.body.appendChild(tmpInputElement);
      // Copy text to clipboard.
      tmpInputElement.select();
      document.execCommand('copy');
      // Finally remove the element.
      document.body.removeChild(tmpInputElement);

      this.toastr.success('Copied text to the clipboard successfully.');
    } catch (err) {
      this.toastr.error('Failed to copy text to the clipboard.');
    }
  }
开发者ID:noahdesu,项目名称:ceph,代码行数:18,代码来源:copy2clipboard-button.directive.ts


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