Topic: Status of ToastModule (Cyclic dependency problem)

wpbest pro asked 5 years ago


Hi MDBootstrap,

Has the Toast/ToastService been deprecated? I don't see any info anymore about it in the Alert section of the docs? And if so, can you tell me why?

And, regardless, Can you still use the ToastService, and if so,Can someone help me understand how to use the ToastService? When I include ToastModule.forRoot() I get errors as per below:

Expected behavior**adding ToastModule.forRoot() to the import array will allow me to use the ToastService *Actual behavior*Adding ToastModule.forRoot() causes a cyclic dependency problem **Resources (screenshots, code snippets etc.)

Uncaught Error: Provider parse errors:Cannot instantiate cyclic dependency! ApplicationRef ("[ERROR ->]"): in NgModule AppModule in ./AppModule@-1:-1 at NgModuleProviderAnalyzer.push../node_modules/@angular/compiler/fesm5/compiler.js.NgModuleProviderAnalyzer.parse (vendor.js:43541) at NgModuleCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.NgModuleCompiler.compile (vendor.js:43905) at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModule (vendor.js:50055) at vendor.js:50014 at Object.then (vendor.js:26423) at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents (vendor.js:50012) at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler.compileModuleAsync (vendor.js:49972) at CompilerImpl.push../node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js.CompilerImpl.compileModuleAsync (vendor.js:91968) at compileNgModuleFactory__PRE_R3__ (vendor.js:69106) at PlatformRef.push../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModule (vendor.js:69289)


Arkadiusz Idzikowski staff answered 5 years ago


You should add ToastModule.forRoot() to your imports and ToastService to the providers array. Please let me know if you encounter any further problems with this component.

You can find Toast documentation in section called 'notifications':

https://mdbootstrap.com/docs/angular/advanced/notifications/



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.5.0
  • Device: Web
  • Browser: Chrome
  • OS: Mac
  • Provided sample code: No
  • Provided link: No