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