Angular Toast Global Options

MDB SupportCategory: MDB AngularAngular Toast Global Options
Mark Olive Pro User asked 6 months ago in MDB pro, version:5.1.2


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:

Angular Alerts

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?

1 Answers
Damian Gemza answered 6 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 User replied 6 months ago

Thanks, that’s nice and easy!