I am getting this error when trying to injected ToastrService into another service.
AppComponent_Host.ngfactory.js? [sm]:1 ERROR Error: StaticInjectorError(AppModule)[InjectionToken ToastConfig]:
StaticInjectorError(Platform: core)[InjectionToken ToastConfig]:
NullInjectorError: No provider for InjectionToken ToastConfig!
at NullInjector.get (core.js:1233)
at resolveToken (core.js:1540)
What am I missing?
Having the same issue here
Sorry missed import forRoot()
To elaborate for anyone having the same issue,
add
ToastrModule.forRoot(),
to your imports array in your app.module.ts file.
I'm having the problem and already have ToastrModule.forRoot()
The strange thing is it's working elsewhere in my project there's just one lazy loaded module and component where I get the error so a bit baffled.
Any reply on this?
Most helpful comment
To elaborate for anyone having the same issue,
add
ToastrModule.forRoot(),to your
importsarray in your app.module.ts file.