Angular Toast Global Options

Mark Olive pro asked 9 months ago


I have created a toast alert and modified some of the individual options, however I don't know how to change the global options.  The documentation is incomplete and there are no examples showing how to change global options:

Quote: 'All individual toast options are included in the global options. See file toastr-config.ts The toastComponent can be inherited and modified.'

Inherited where and how?

Damian Gemza answered 9 months ago

Hello Mark Olive,

Indeed, that documentation of alerts isn't clear about configuring global options.. I'll fix this today.

You can change your's global options in ToastModule.forRoot(), which is placed in your's imports table in app.module.ts

For example, if you want to set global option that allows only 2 alerts to be visible at time, you should configure your's ToastModule.forRoot() is this way:

So your's whole imports table should looks in this way:
imports: [ BrowserModule, MDBBootstrapModules.forRoot(), ToastModule.forRoot({maxOpened:2}) ],
Hope that you understand what i'm talking about.
Best Regards,

Mark Olive pro commented 9 months ago

Thanks, that's nice and easy!

Please insert min. 20 characters.


Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No