當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ng2-toastr.ToastsManager類代碼示例

本文整理匯總了TypeScript中ng2-toastr.ToastsManager的典型用法代碼示例。如果您正苦於以下問題:TypeScript ToastsManager類的具體用法?TypeScript ToastsManager怎麽用?TypeScript ToastsManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ToastsManager類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: 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

示例2: constructor

  constructor(private toastr: ToastsManager, vRef: ViewContainerRef,
              public router: Router,
              public cognitoLoginService: CognitoLoginService) {

    this.toastr.setRootViewContainerRef(vRef);

  }
開發者ID:BruceCutler,項目名稱:aws-serverless-workshops,代碼行數:7,代碼來源:login.component.ts

示例3: saveEmergency

 saveEmergency() {
   if (this.formEmergency.valid) {
     if (this.patients.length > 0) {
       const emergency = {
         date: this.formEmergency.get('date').value,
         type_emergency: this.formEmergency.get('category').value,
         driver: this.driverSelected,
         ambulance: this.ambulanceSelected,
         paramedic: this.paramedicsSelected,
         patient: this.patients,
         location: {
           type: 'Point',
           coordinates: this.positions
         }
       };
       this.formEmergency.reset({
         driver: '',
         ambulance: '',
         paramedics: ''
       });
       this._emergencyService.save(emergency).subscribe(
         (res) => {
           console.log(res.json());
         },
         (error) => {
           console.log(error.json());
         }
       );
     }else{
       this._toast.info('Debe ingresar al menos un paciente', 'Emergencias!');
     }
   }else{
     this._toast.info('Todos los campos marcados con * son obligatorios', 'Emergencias!');
   }
 }
開發者ID:manuelao-s4ds,項目名稱:Emergencies-ui,代碼行數:35,代碼來源:emergency.component.ts

示例4:

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

示例5: ngOnInit

 ngOnInit(): void {
   this.toastr.setRootViewContainerRef(this._vcr);
   this.toastr.onClickToast().subscribe( toast => {
       this.toastr.dismissToast(toast);
     });
   this._tokenService.init({
     apiPath: 'api',
     signInRedirect: 'auth'
   });
 }
開發者ID:asiman161,項目名稱:easy-tests,代碼行數:10,代碼來源:app.component.ts

示例6: save

  save() {
    if (this.formParamedics.valid) {
      const paramedic = {
        name: this.formParamedics.get('name').value,
        lastname: this.formParamedics.get('lastname').value,
        phone: this.formParamedics.get('phone').value,
        cellPhone: this.formParamedics.get('cellPhone').value,
        gender: this.formParamedics.get('gender').value,
        birthdate: this.formParamedics.get('birthdate').value,
        specialization: this.formParamedics.get('specialization').value
      };
      this._paramedicsService.save(paramedic).subscribe(
        (res) => {
          this._toast.success(`Se registro el paramedico ${res.json().name}`, 'Paramedicos!');
          this.formParamedics.reset({
            gender: ''
          })
        },
        (error) => {
          console.log(error.json());
          this._toast.error(`Ocurrio un error al registrar al paramedico`, 'Paramedicos!');
        }
      );
    }else {
      this._toast.info(`Todos los campos marcados con * son obligatorios`, 'Paramedicos!');

    }
  }
開發者ID:manuelao-s4ds,項目名稱:Emergencies-ui,代碼行數:28,代碼來源:paramedics.component.ts

示例7: saveAmbulance

 saveAmbulance() {
   if (this.formAmbulance.valid) {
     const ambulance = {
       car: this.formAmbulance.get('car').value,
       car_plate: this.formAmbulance.get('car_plate').value,
       type_ambulance: this.formAmbulance.get('type_ambulance').value,
       available: this.formAmbulance.get('available').value
     };
     this.formAmbulance.reset({
       car: '',
       car_plate: '',
       type_ambulance: '',
       available: ''
     });
     this._ambulanceService.save(ambulance).subscribe(
       (res) => {
         console.log(res.json());
       },
       (error) => {
         console.log(error.json());
       }
     );
   }else {
     this._toast.info('Todos los campos marcados con * son obligatorios', 'Ambulancias!');
   }
 }
開發者ID:manuelao-s4ds,項目名稱:Emergencies-ui,代碼行數:26,代碼來源:ambulances.component.ts

示例8: toastWarning

  /*
   * Displays a warning message
   */
  toastWarning(reason?: string)
  {
    let key: string;
    switch(reason)
    {
      case 'accessDenied':
        key = 'TOASTR.WARNING.ACCESS';
        break;
      case 'noResult':
        key = 'TOASTR.WARNING.TIMEOUT';
        break;
      case 'timeout':
        key = 'TOASTR.WARNING.TIMEOUT';
        break;
      default:
        key = 'TOASTR.WARNING.DEFAULT';
        break;
    }

    let message: string;
    this.translateService.get(key).subscribe(
      value => {
        message = value;
      });

    this.toastr.warning(message)
  }
開發者ID:jodogne,項目名稱:orthanc-explorer-2,代碼行數:30,代碼來源:app.component.ts

示例9: toastInfo

  /*
   * Displays an info message
   */
  toastInfo(reason?: string)
  {
    let message: string;
    let key: string;

    switch(reason)
    {
      case 'jobRegistered':
        key = 'TOASTR.INFO.JOB';
        break;
      case 'noResult':
        key = 'TOASTR.INFO.NORESULT';
        break;
      case'restartNeeded':
        key = 'TOASTR.INFO.RESTART';
        break;
      default:
        key = 'TOASTR.INFO.DEFAULT';
        break;
    }

    this.translateService.get(key).subscribe(
      value => {
        message = value;
      });

    this.toastr.info(message)
  }
開發者ID:jodogne,項目名稱:orthanc-explorer-2,代碼行數:31,代碼來源:app.component.ts

示例10: 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


注:本文中的ng2-toastr.ToastsManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。