Alert Service

class AlertService

This service is a wrapper for communicating with MatSnackBar , which manages alerts.

It shows alerts for a duration configured in app.config.ts. An optional callback can also be passed which is executed on clicking the CTA (Call To Action) within the alert.

alert.service.ts
@Injectable({
  providedIn: 'root',
})
export class AlertService {
  private readonly _matSnackBar = inject(MatSnackBar);
  private readonly _loggerService = inject(LoggerService);
  private readonly _settingsService = inject(SettingsService);

  private readonly _directionality: LanguageOption['directionality'];

  public constructor() {
    // Buy to unlock
  }

  public showAlert(message: string, cta?: string, action?: () => void): void {
    // Buy to unlock
  }
}

Last updated