Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Angular Toast Global Options

Mark Olive pro asked 6 years ago


Hi, 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: https://mdbootstrap.com/angular/advanced/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?

Damian Gemza staff answered 6 years 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:
ToastModule.forRoot({maxOpened:2})
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,
Damian

Mark Olive pro commented 6 years ago

Thanks, that's nice and easy!


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags