So i use the the angular2-toaster packages and i always recieve double notifications. below is an example for the use of this package.
I dont know why this happens, but i know if i reload my angular2 app in the browser this problem is fixxed. Does someone know where the problem is?
Promotion.service.ts
private toasterService: ToasterService;
public toasterconfig : ToasterConfig =
new ToasterConfig({
tapToDismiss: true,
timeout: 5000
});
constructor(
private ApiClientService: ApiClientService,
toasterService: ToasterService
) {
this.toasterService = toasterService;
}
postVoucher(payload: JSON){
let serviceDec = "voucher";
let response;
let status;
let title;
let text;
//console.log(JSON.stringify(payload));;
return this.ApiClientService.postAPIObject(serviceDec, payload).then((response) => {
//console.log(response['response_payload']['id']);
if(response['status']['statusCode']==0){
this.router.navigate(['/Promotion', response['response_payload']['id']]);
status = 'success';
title = 'Erledigt!';
text = 'Promotion erstellt';
} else {
status = 'error';
title = 'Fehler';
text = 'Promotion konnte nicht erstellt werden';
}
this.toasterService.pop(status, title, text);
});
}
If you need more Code of other parts, just leave a comment and i will deliver.
For all out there who has the same problem, here are some checkpoints to check which may run the problem.