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


TypeScript ToastrService.info方法代码示例

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


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

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

示例2: map

 map(success => {
   this.success = success
   if (this.success.type === 'info') {
     this.toastrService.info(this.success.message, this.success.type)
     return this.success.type;
   }
   else {
     this.toastrService.success(this.success.message, this.success.type)
     return this.success.type;
   }
 },
开发者ID:leninloganathan,项目名称:angularspree,代码行数:11,代码来源:product.service.ts

示例3: onLinkButtonClick

  onLinkButtonClick() {
    let infoToast = this.toastrService.info('Linking references...', 'Loading', HOVER_TO_DISMISS_INDEFINITE_TOAST);

    const references = this.jsonStoreService.getIn(['references']);
    this.apiService.getLinkedReferences(references)
      .then(linkedReferences => {
        this.jsonStoreService.setIn(['references'], linkedReferences);

        this.toastrService.clear(infoToast.toastId);
        this.toastrService.success(`References are linked.`, 'Success');
      }).catch(error => {
        this.toastrService.clear(infoToast.toastId);
        this.toastrService.error('Could not link references', 'Error');
      });
  }
开发者ID:inspirehep,项目名称:record-editor,代码行数:15,代码来源:link-references-button.component.ts

示例4: onMergeClick

  onMergeClick() {
    let infoToast = this.toastrService.info('Merging records...', 'Loading', HOVER_TO_DISMISS_INDEFINITE_TOAST);

    this.recordApiService
      .saveRecord(this.record)
      .switchMap(() => {
        return this.recordApiService.manualMerge(this.updateRecordId);
      }).subscribe(mergeWorkflowObjectId => {
        this.toastrService.clear(infoToast.toastId);
        this.router.navigate([`holdingpen/${mergeWorkflowObjectId}`]);
      }, () => {
        this.toastrService.clear(infoToast.toastId);
        this.toastrService.error('Could not merge!', 'Error');
      });
  }
开发者ID:inspirehep,项目名称:record-editor,代码行数:15,代码来源:manual-merge-modal.component.ts

示例5: onFileSelect

  onFileSelect(file: File) {
    if (file) {
      let infoToast = this.toastrService.info('Uploading file...', 'Wait', HOVER_TO_DISMISS_INDEFINITE_TOAST);

      this.apiService.uploadFile(file)
        .subscribe(uploadedPath => {
          this.jsonStoreService.addIn(['documents', '-'], { url: uploadedPath, key: file.name });

          this.toastrService.clear(infoToast.toastId);
          this.toastrService.success(`File uploaded`, 'Success');
        }, error => {
          this.toastrService.clear(infoToast.toastId);
          this.toastrService.error('Could not upload the file', 'Error!');
        });
    }
  }
开发者ID:inspirehep,项目名称:record-editor,代码行数:16,代码来源:file-upload-button.component.ts

示例6: showSavedMessage

  showSavedMessage() {
    if (this._savedSeverity === '' || this._savedMessage === '') {
      return;
    }

    if (this._savedSeverity === 'error') {
      this._toastr.error(this._savedMessage);
    } else if (this._savedSeverity === 'warning') {
      this._toastr.warning(this._savedMessage);
    } else if (this._savedSeverity === 'info') {
      this._toastr.info(this._savedMessage);
    } else if (this._savedSeverity === 'success') {
      this._toastr.success(this._savedMessage);
    }

    this._savedSeverity = '';
    this._savedMessage = '';
  }
开发者ID:epot,项目名称:Gifter,代码行数:18,代码来源:error-handle.service.ts

示例7:

 this.languageService.loadLanguage().subscribe(res => {
   const alert = res.pcprepkit.activityAccess.alert;
   this.router.navigate(['/menu']);
   this.toastr.info(alert);
   return false;
 });
开发者ID:systers,项目名称:PC-Prep-Kit,代码行数:6,代码来源:activity.guard.ts

示例8: info

 info(text: string) {
   this.toastr.info(text);
 }
开发者ID:demoiselle,项目名称:generator-demoiselle,代码行数:3,代码来源:notification.service.ts

示例9:

 .then(() => {
   // TODO: move toast call out of then after https://github.com/angular/angular/pull/18352
   loadingToastId = this.toastrService.info(
     `Loading ${recordType}/${recordId}`, 'Wait').toastId;
   return this.apiService.fetchRecord(recordType, recordId);
 }).then(json => {
开发者ID:inspirehep,项目名称:record-editor,代码行数:6,代码来源:json-editor-wrapper.component.ts

示例10:

 this.productService.markAsFavorite(this.product.id).subscribe(res => {
   this.toastrService.info(res['message'], 'info');
 });
开发者ID:leninloganathan,项目名称:angularspree,代码行数:3,代码来源:product-details.component.ts


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