Preventing alerts duplicates


Topic: Preventing alerts duplicates

mdb2 pro asked 6 years ago

Regarding https://mdbootstrap.com/angular/advanced/alerts/#options Most of the time I want the alerts to stack up, one on top the other until they disappear, so maxOpened should be 0 There are alerts that I want to replace inline, so maxOpened should be 1 How can I change it during run time as maxOpened is a global option ?  

Damian Gemza staff commented 6 years ago

Dear mdb2, There's no possibility to change maxOpened value during your application lifecycle. Instead of it, please try to set maxOpened as 1, and add preventDuplicates: true. Maybe this way will fit your needs. https://mdbootstrap.com/angular/advanced/alerts/#options Best Regards, Damian

mdb2 pro commented 6 years ago

I assume that preventDuplicates only prevent exactly the same alerts. In my case they are similar but not identical. In jquery it was working fine

Arkadiusz Idzikowski staff answered 6 years ago

Dear mdb2,

Inject ToastService to your component typescript file and try to change 'maxOpened' option with this code:

constructor(private toastrService: ToastService) { }

this.toastrService.toastConfig.maxOpened = 3;

Regards,
Arek


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
  • User: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No