本文整理汇总了TypeScript中angular2-toaster.ToasterService.pop方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ToasterService.pop方法的具体用法?TypeScript ToasterService.pop怎么用?TypeScript ToasterService.pop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2-toaster.ToasterService
的用法示例。
在下文中一共展示了ToasterService.pop方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
() => {
this.toaster.pop(
'success',
'Message Sent',
'Your message has been sent. Someone will get back to you at the earliest opportunity.'
);
}
示例2: canActivate
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
if (!this.authorizationService.getPayload) {
this.toasterService.pop('warning', 'Unauthorized Access', 'Please login');
this.router.navigate(['/login'], { queryParams : { return: state.url } });
return false;
}
if (!this.authorizationService.getActivePayload) {
this.authorizationService.deleteToken();
this.toasterService.pop('warning', 'Your Session has Expired', 'Please login');
this.router.navigate(['/login'], { queryParams : { return: state.url } });
return false;
}
if (state.url === '/administration/manage-players' || state.url === '/administration/manage-coaches') {
if (!this.authorizationService.getActivePayload.userProfile.isAdministrator) {
this.toasterService.pop('warning', 'Unauthorized Access', 'Administrator access only');
this.router.navigate(['/groups']);
return false;
}
}
else {
if (/^\/players\/(?:[^%]|%[0-9A-Fa-f]{2})+\/2[0-9]{3}$/.test(state.url)) {
let userProfile: IUserProfile = this.authorizationService.getActivePayload.userProfile;
if (!userProfile.isAdministrator) {
if (!(userProfile.isManager && userProfile.groups.find(group => group === +route.url[2].path))) {
this.toasterService.pop('warning', 'Unauthorized Access', 'Group Manager access only');
this.router.navigate(['/groups']);
return false;
}
}
}
}
return true;
}
示例3:
.then((nbr: number) => {
if (nbr > 0) {
this.eventService.refreshEventDetail().then(() => {
this.toaster.pop('success', 'Groups Added', `${nbr} additional groups were added to the event`);
});
} else {
this.toaster.pop('warning', 'No Groups Added', 'No additional groups were added to the event. Are the par 3s already full?');
}
})
示例4: canActivate
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
if (this.authorizationService.getActivePayload) {
this.toasterService.pop('success', 'Active Session Found', 'Redirecting to Home');
this.router.navigate(['/groups']);
return false;
}
return true;
}
示例5: showNotification
showNotification(type: MessageType, title: string, message: string, icon?: string): void {
switch (+type) {
case MessageType.Error:
this.toasterService.pop('error', title, message);
break;
case MessageType.Info:
this.toasterService.pop('info', title, message);
break;
case MessageType.Wait:
this.toasterService.pop('wait', title, message);
break;
case MessageType.Success:
this.toasterService.pop('success', title, message);
break;
case MessageType.Warning:
this.toasterService.pop('warning', title, message);
break;
default:
this.toasterService.pop('info', 'Whut?', 'Can not get message type');
}
}
示例6: if
return next.handle(request).pipe(catchError(err => {
if (err.status === 401 && err.error==null) {
this.toasterService.pop('error','','Session Expired.');
this.authenticationService.logout();
location.reload(true);
}
else if(err.status === 403 && err.error==null){
this.toasterService.pop('error','','You are not authroized.');
}
else if(err.status === 500 && err.error==null){
this.toasterService.pop('error','','Internal Server Error.');
}
else if(err.error)
{
this.toasterService.pop('error','',err.error.Message)
}
else
{
this.toasterService.pop('error','','Something went wrong. Please try again later.');
}
return throwError(err);
}))
示例7:
error: (error: any) => {
if (error instanceof HttpErrorResponse) {
let router: Router = this.injector.get(Router);
console.error('HTTP error Response received at [' + router.url + ']:', error);
if (error.status === 401) {
if (error.url.indexOf('api/authenticate') === -1 && error.url.indexOf('api/writeLog') === -1
&& error.url.indexOf('api/verifyUserToken') === -1) {
// These conditions should never occur because they will be caught in the route gaurds.
// Leaving them here though just in case (IE. someone could have hacked the JSON Web Token).
if (this.authorizationService.getPayload) {
if(!this.authorizationService.getActivePayload) {
this.authorizationService.deleteToken();
this.toasterService.pop('warning', 'Your session has Expired', 'Please login');
router.navigate(['/login']);
}
else {
this.toasterService.pop('warning', 'Unauthorized Access', 'Permission denied');
router.navigate(['/groups']);
}
}
else {
this.toasterService.pop('warning', 'Unauthorized Access', 'Please login');
router.navigate(['/login']);
}
}
}
else {
let alertService: AlertService = this.injector.get(AlertService);
alertService.error(error.message, error.error.error ? error.error.error.message: "");
}
}
}
示例8: registerOnline
registerOnline(): void {
if (!this.registrationGroup.registrations[0].isNetSkinsFeePaid && !this.registrationGroup.registrations[0].isGrossSkinsFeePaid) {
this.toaster.pop('warning', 'Invalid', 'Select the scratch or flighted bracket.');
return;
}
this.registrationService.reserve(this.eventDetail.id)
.then(() => {
// preserve the registration choices made
let group = this.registrationService.currentGroup;
let registration = _.merge({}, group.registrations[0], this.registrationGroup.registrations[0]);
this.paymentGroup = _.merge({}, group, this.registrationGroup);
this.paymentGroup.registrations[0] = registration;
this.updatePayment();
this.paymentComponent.open();
})
.catch((err: string) => {
this.toaster.pop('error', 'Error', err);
});
}
示例9: handleError
handleError(error) {
this.toasterService.pop('error',error.statusText,error.message);
// IMPORTANT: Rethrow the error otherwise it gets swallowed
throw error;
}