Open JLNNN opened 4 years ago
Hi,
You may check out if there are more than one instance of ToastrService in your application.
Here is my testing case in my application:
Hope this would help!
Hey, I solved the problem by injecting the NgxToastrService in my custom Service like so:
import { Injectable } from '@angular/core';
import {
IndividualConfig,
ToastrService as NgxToastrService,
} from 'ngx-toastr';
import { ResponseError } from '../types/response-error.type';
@Injectable({
providedIn: 'root',
})
export class ToastrService {
constructor(private ngxToastrService: NgxToastrService) {}
success(
message?: string,
title?: string,
options?: Partial<IndividualConfig<any>>,
) {
this.ngxToastrService.success(message, title, options);
}
responseError(
response: ResponseError,
title?: string,
options?: Partial<IndividualConfig<any>>,
) {
....
....
....
return this.ngxToastrService.error(message, title, options);
}
}
Hey,
when I'm using
class MyToastrService extends ToastrService {
to "wrap" the ToastrService into my own, all the toast messages are still in dom after being dismissed. Is that an intended behaviour?When using the original ToastrService, everything is working fine.
Thanks in advance, Julian