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: MDB Angular: close an alert before open a new one

diegomoreno_2000 pro asked 1 year ago


Expected behavior Programatically close or hide an alert before open a new one

Actual behavior Many alerts are shown at the same time. When stacked option is not used, the newest overlaps the previous one

Resources (screenshots, code snippets etc.) I'm using the docs samples



The notification service returns a MdbNotificationRef which gives you access to the currently open alert instance. You can use it to close the current alert before opening a new one:

  openAlert(): void {
    if (this.notificationRef) {
      this.notificationRef.close();
    }

    this.notificationRef = this._notificationService.open(YourComponent);
  }

diegomoreno_2000 pro commented 1 year ago

Thank you, it works.



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: MDB5 4.0.0
  • Device: PC
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No