本文整理匯總了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;
}
}
示例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;
}
},
示例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');
});
}
示例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');
});
}
示例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!');
});
}
}
示例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 = '';
}
示例7:
this.languageService.loadLanguage().subscribe(res => {
const alert = res.pcprepkit.activityAccess.alert;
this.router.navigate(['/menu']);
this.toastr.info(alert);
return false;
});
示例8: info
info(text: string) {
this.toastr.info(text);
}
示例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 => {
示例10:
this.productService.markAsFavorite(this.product.id).subscribe(res => {
this.toastrService.info(res['message'], 'info');
});