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


TypeScript ToastrService.error方法代码示例

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


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

示例1:

 }).catch(error => {
   this.toastrService.clear(loadingToastId);
   if (error.status === 403) {
     this.toastrService.error(`Logged in user can not access to the record: ${recordType}/${recordId}`, 'Forbidden');
   } else {
     this.toastrService.error('Could not load the record!', 'Error');
   }
 });
开发者ID:inspirehep,项目名称:record-editor,代码行数:8,代码来源:json-editor-wrapper.component.ts

示例2: onSaveError

  private onSaveError(error: ApiError) {
    if (error.message) {
      this.toastrService.error(error.message, 'Error', HOVER_TO_DISMISS_INDEFINITE_TOAST);
    } else {
      this.toastrService.error('Could not save the record', 'Error');
    }

    this.modal.hide();
  }
开发者ID:inspirehep,项目名称:record-editor,代码行数:9,代码来源:save-preview-modal.component.ts

示例3: catchError

      catchError((err: HttpErrorResponse) => {
        switch (err.status) {
          case 400:
            this.toast.error(err.error.errors, "Warning!");
            break;
          case 401:
            this.toast.error(err.error.message, "Warning!");
            break;
        }

        return throwError(err);
      })
开发者ID:AndonMitev,项目名称:JS-Web,代码行数:12,代码来源:error.interceptor.ts

示例4: handleGenericError

    /**
     * Try to handle the error in some sane way, if possible.
     *
     * @param {HttpRequest<any>} request
     * @param response
     * @returns {Observable<any>}
     */
    private handleGenericError(request: HttpRequest<any>, response: any): Observable<any> {
        if (response instanceof HttpErrorResponse) {
            // response.url can be null in some cases (i.e. forbidden OPTIONS request or super fatal error 500 with no content at all)
            // this is why we use request.url instead as it will always have the proper url to the endpoint we're requesting.
            let url = this.getURI(request);

            // same goes for response.error which could be string | ProgressEvent.
            // response.error (angular) != response.error.error (backend)
            let error = '';
            if (response.hasOwnProperty('error')
                && response.error != null
                && response.error.hasOwnProperty('error')
            ) {
                error = response.error.error;
            } else if (!(response.error instanceof ProgressEvent)) {
                error = response.error;
            } else {
                error = response.message;
            }

            this.notify.error(error, 'Failed to complete request ' + url);
        }

        return of(response);
    }
开发者ID:strongbox,项目名称:strongbox-web-ui,代码行数:32,代码来源:error.interceptor.ts

示例5: canActivate

  canActivate(
    next: ActivatedRouteSnapshot,
    state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
    const nextRouteUrl = state.url;
    const routeClaims = this.getRouteClaims(nextRouteUrl);
    let routeCanActivate = true;

    if (this.signInRequired(nextRouteUrl) && !this.authService.isAuthenticated()) {
      this.toastr.info('ابتدا باید با نام کاربری خود وارد سامانه شوید');
      this.router.navigate(['/login']);
      return false;
      // this.authService.signIn().subscribe(result => {
      //   if (result) {
      //     for (let claim of routeClaims) {
      //       routeCanActivate = routeCanActivate && this.authService.userHasClaim(claim);
      //     }
      //     if (!routeCanActivate) {
      //       this.snackBar.open('شما مجوز دسترسی به این بخش را ندارید', 'خطا', { duration: 2000 });
      //     }
      //     if (routeCanActivate) this.router.navigate([nextRouteUrl]);
      //     return routeCanActivate;
      //   } else {
      //     return false;
      //   }
      // });
    } else {
      for (const claim of routeClaims) {
        routeCanActivate = routeCanActivate && this.authService.userHasClaim(claim);
      }
      if (!routeCanActivate) {
        this.toastr.error('شما مجوز دسترسی به این بخش را ندارید', 'خطا');
      }
      return routeCanActivate;
    }
  }
开发者ID:myprojectsfile,项目名称:taavoni,代码行数:35,代码来源:auth.guard.ts

示例6: submit

	submit(): void {
		const validationMessage = this.validate();
		if (validationMessage) {
			this.toastrService.error(validationMessage);
			return;
		}

		const toSubmit = WorkingUser.toUser(this.workingUser);

		//If user has an ID, user already exists, call update
		if (toSubmit.id) {
			this.settingsService
				.editUser(toSubmit)
				.then(user => this.activeModal.close({
					user,
					isEdit: true,
				}))
				.catch(e => this.toastrService.error(e.message));
		} else {
			this.settingsService
				.addUser(toSubmit)
				.then(user => this.activeModal.close({
					user,
					isEdit: false,
				}))
				.catch(e => this.toastrService.error(e.message));
		}
	}
开发者ID:iadgov,项目名称:WALKOFF,代码行数:28,代码来源:settings.user.modal.component.ts

示例7:

                  // tslint:disable-next-line:no-shadowed-variable
                  (result: any) => {
                    const tedadKolSahamForushUser: number =
                      result.tedadKolSahamForush || 0;
                    // محاسبه مجموع سهام تمامی درخواست های فروش فعلی کاربر
                    const tedadMojoud = tedadDarayi - tedadKolSahamForushUser;
                    console.log(`tedadDarkhast:${tedadDarkhast}`);
                    console.log(`tedadDarayi:${tedadDarayi}`);
                    console.log(
                      `tedadKolSahamForushUser:${tedadKolSahamForushUser}`
                    );
                    console.log(`tedadMojoud:${tedadMojoud}`);

                    if (tedadDarkhast > tedadMojoud) {
                      this.toastr.error(
                        'تعداد سهام درخواست فروش  بیشتر از تعداد دارایی سهام شما می باشد'
                      );
                      return;
                    }
                    // در صورتی که تعداد سهام جهت فروش بیشتر از دارایی نباشد درخواست را ثبت میکنیم
                    this.apiService.sabtDarkhastForush(darkhast).subscribe(
                      () => {
                        this.getSafeForush();
                        this.toastr.success(
                          'درخواست فروش شما با موفقیت به صف فروش افزوده شد'
                        );
                      },
                      error => {
                        console.log(error);
                        this.toastr.error('خطا در افزودن درخواست به صف فروش');
                      }
                    );
                  },
开发者ID:myprojectsfile,项目名称:taavoni,代码行数:33,代码来源:queue.component.ts

示例8: rowUpdating

 rowUpdating(e) {
   const newTedadSahm = e.newData.tedadSahm;
   const oldTedadSahm = this.oldTedadSahm;
   if (newTedadSahm < oldTedadSahm) {
     console.log(e);
     const rowData = e.oldData;
     rowData.tedadSahm = newTedadSahm;
     this.apiService.updateDarkhast(rowData, this.editingRowKey).subscribe(() => {
       this.toastr.success('تعداد با موفقیت کاهش یافت');
       this.editingMode = false;
       this.listDarkhastGrid.instance.cancelEditData();
       e.cancel = true;
       this.getListDarkhast();
     }, (error) => {
       this.toastr.error('خطا در کاهش تعداد');
       e.cancel = true;
       this.listDarkhastGrid.instance.cancelEditData();
       console.log(error);
     });
   } else {
     this.toastr.error('شما تنها مجاز به کاهش تعداد هستید');
     e.cancel = true;
     this.editingMode = false;
     this.listDarkhastGrid.instance.cancelEditData();
   }
 }
开发者ID:myprojectsfile,项目名称:taavoni,代码行数:26,代码来源:request-admin.component.ts

示例9:

 this.Api.login(details).subscribe(data=>{
   if(data.StatusCode==200){
    this.toaster.success('Login Successfll', 'Login Success');
    this.router.navigate(['/dashboard'])
   }
   else{
    this.toaster.error('Incorrect Username and pasword', 'Login Failed');
   }
 })
开发者ID:troplr,项目名称:swift-wallet,代码行数:9,代码来源:login.component.ts

示例10: import

 async import (file: ReadFile) {
   const profile = this.configService.importFile(file)
   if (!profile) {
     this.toastr.error('Import failed')
     return
   }
   const alias = await this.configService.saveProfile(profile)
   this.configService.selectProfile(alias)
 }
开发者ID:ChristosGeorgiou,项目名称:balance,代码行数:9,代码来源:manage.component.ts


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