本文整理汇总了TypeScript中toastr.error函数的典型用法代码示例。如果您正苦于以下问题:TypeScript error函数的具体用法?TypeScript error怎么用?TypeScript error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: showUINotificationInfo
function showUINotificationInfo(uiNotificationInfo: UINotificationInfo) {
if (uiNotificationInfo.succeeded) {
toastr.success(uiNotificationInfo.successMessage);
} else {
toastr.error(uiNotificationInfo.errorMessage);
}
}
示例2: handle
handle(error:any) {
if (error.status === 401) {
toastr.error('Please sign in');
this.loginService.logout();
this.router.navigate(['/Login']);
}
}
示例3: onSubmit
public onSubmit(): void {
if (this.registerForm.value.password !== this.registerForm.value.confirmPassword) {
toastr.error("Passwords don't match");
} else {
this.endpoint.register(this.registerForm.value);
}
}
示例4: error
static error(err:any) {
let message = JSON.stringify(err);
if(err && err.message) {
message = err.message;
}
toastr.error(message);
}
示例5: switch
this.toastsPromise.then((toasts: IToast[]) => {
for (let t of toasts){
//Setup callbacks to track dismisal status
let overrides: ToastrOptions = {
onclick: () => {
ToastService.acknowledgeToast(t.Id, this.context.pageContext.web.id);
},
onCloseClick: () => {
ToastService.acknowledgeToast(t.Id, this.context.pageContext.web.id);
}
};
switch (t.Severity){
case 'Warning':
toastr.warning(t.Message, t.Title, overrides);
break;
case 'Error':
toastr.error(t.Message, t.Title, overrides);
break;
case 'Success':
toastr.success(t.Message, t.Title, overrides);
break;
default:
toastr.info(t.Message, t.Title, overrides);
break;
}
}
}).catch((error: any): void => {
示例6: handleError
private handleError(error:Response) {
let _error = error.json();
console.log(error);
console.error(_error);
toastr.error(_error.message);
return Observable.throw(_error.error || 'Server error');
}
示例7: login
login(loginCredentials).then((response) => {
if (response.succeded) {
dispatch(loginRequestSuccessAction(response));
navigationHelper.navigateToPath(`/${response.userProfile.role}`);
} else {
toastr.error(loginErrorMessages.credentials);
}
});
示例8: handleError
private handleError(error) {
switch (error.status) {
case 400:
if (error.json()['code'] === 'email_already_taken') {
toastr.error('This email is already taken.');
}
}
}
示例9: showError
function showError(err) {
let errorMessage = err;
if (_.isError(err)) {
errorMessage = err.message;
}
toastr.error(errorMessage);
}
示例10: handleError
private handleError (error: any) {
// In a real world app, we might send the error to remote logging infrastructure
let errMsg = error._body || 'Server error';
console.error(errMsg); // log to console instead
if (error.status >= 500) {
toastr.error('An error has occured. Please contact support for further assistance');
} else {
toastr.warning(errMsg);
}
return Observable.throw(errMsg);
}