A lightweight library for managing alerts in Angular applications, meant to be used with 3rd party libraries like Angular Material or Bootst
README.md
npm install @wamlib/ngx-alert-manager

Initialization #

export const appConfig: ApplicationConfig = {
 providers: [
   provideAlertManager()
 ]
};

Initialization (With optional custom queue interval) #

export const appConfig: ApplicationConfig = {
 providers: [
   provideAlertManager({ queueInterval: 1000 })
 ]
};

Usage #

App Component (Listen for alerts in the app.component.ts) #

import { NgxAlertManager } from '@wamlib/ngx-alert-manager';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';

@Component({...})
export class AppComponent {
  private alertManager = inject(NgxAlertManager);

  constructor() {
    this.alertManager.getAppAlertStream()
      .pipe(takeUntilDestroyed())
      .subscribe(alert => {
        // Logic for your 3rd party library goes here
        console.log('Displaying Alert:', alert.alert.title);
        // Call the callback when the user finishes
        // alert.callback?.(resultFromLibrary);
      });
  }
}

Any Component (Sending an alert) #

import { NgxAlertManager, NGX_ALERT_TYPE_ENUM, ALERT_EVENT_CALLBACK_TYPE_ENUM } from '@wamlib/ngx-alert-manager';

@Component({...})
export class AnyComponent {
  private alertManager = inject(NgxAlertManager);

  showAlert() {
    this.alertManager.sendAlert({
      alert: {
        title: 'Success!',
        description: 'Operation completed successfully.',
        alertType: NGX_ALERT_TYPE_ENUM.SUCCESS,
        alertEventCallback: ALERT_EVENT_CALLBACK_TYPE_ENUM.SHOWN
      },
      callback: (data) => console.log('Alert shown', data)
    });
  }
}