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