ngx-toastr icon indicating copy to clipboard operation
ngx-toastr copied to clipboard

duplicated service when used in APP_INITIALIZER

Open maybeec opened this issue 5 years ago • 1 comments

Related to #328, there seems to be an issue with the creation of APP_INITIALIZERS, which depend on toastr. Here an example:

If you specify

{ provide: ConfigService, useClass: ConfigService, deps: [HttpBackend, ToastrService, TranslateService] },
{ provide: APP_INITIALIZER, useFactory: configServiceFactory, deps: [ConfigService], multi: true }

you end up in having ConfigService instantiated twice. I did some debugging and it seems, that by Toastr Overlay instantiation a new ConfigService is created, which is to taken up by AppModule instantiation.

maybeec avatar Dec 09 '19 14:12 maybeec