Ngx-toastr: ToastConfig isn't resolved

Created on 2 Sep 2018  路  6Comments  路  Source: scttcper/ngx-toastr

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?

Most helpful comment

To elaborate for anyone having the same issue,
add
ToastrModule.forRoot(),
to your imports array in your app.module.ts file.

All 6 comments

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?

Was this page helpful?
0 / 5 - 0 ratings