Skip to content

AlertsService

reference
1 min readUpdated

Kind: Class

Source: Frontend/src/app/components/shared/alerts/alerts.service.ts (line 36)

Part of: Frontend

AlertsService centralizes alert actions for shared frontend components. It exposes methods for standard alerts, translated alerts, and error alerts so callers do not duplicate alert-handling logic.

Methods

MethodSignatureReturns
goAlert`goAlert(type: string'W'
goTranslatedAlert`goTranslatedAlert(type: string'W'
goAlertError`goAlertError(type: string'W'

Properties

PropertyType
_alertAlerts
alertany
_alertTranslatedAlertsTranslated
alertTranslatedany
type`string
msgAlertMsg

Diagram

mermaid
graph LR
  Component[Frontend Component] --> Service[AlertsService]
  Service --> Standard[goAlert()]
  Service --> Translated[goTranslatedAlert()]
  Service --> Error[goAlertError()]
  Standard --> AlertUI[Alert Display]
  Translated --> AlertUI
  Error --> AlertUI

Usage

ts
import { Component, inject } from '@angular/core';
import { AlertsService } from './components/shared/alerts/alerts.service';

@Component({
  selector: 'app-example',
  template: `
    <button (click)="showAlert()">Show alert</button>
    <button (click)="showTranslatedAlert()">Show translated alert</button>
    <button (click)="showError()">Show error</button>
  `,
})
export class ExampleComponent {
  private readonly alertsService = inject(AlertsService);

  showAlert(): void {
    this.alertsService.goAlert();
  }

  showTranslatedAlert(): void {
    this.alertsService.goTranslatedAlert();
  }

  showError(): void {
    this.alertsService.goAlertError();
  }
}

AI Coding Instructions

  • Inject AlertsService into components or services that need to trigger alert behavior.
  • Use goAlert() for standard alert flows and goAlertError() for error-related flows.
  • Use goTranslatedAlert() when the alert content must follow the application's translation flow.
  • Keep alert decisions in calling code and route display behavior through AlertsService.

Used by

171 references from 171 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (171)

  • AppComponentFrontend/src/app/app.component.ts:1
  • MrqDetailsComponentFrontend/src/app/components/MRQ/mrq-details/mrq-details.component.ts:1
  • MrqInquiryComponentFrontend/src/app/components/MRQ/mrq-details/mrq-inquiry/mrq-inquiry.component.ts:1
  • MrqListComponentFrontend/src/app/components/MRQ/mrq-list/mrq-list.component.ts:1
  • BillOfMaterialsDetailsComponentFrontend/src/app/components/bill-of-materials/bill-of-materials-details/bill-of-materials-details.component.ts:1
  • BillOfMaterialsListComponentFrontend/src/app/components/bill-of-materials/bill-of-materials-list/bill-of-materials-list.component.ts:1
  • BlogPopupComponentFrontend/src/app/components/blogs/blog-popup/blog-popup.component.ts:1
  • BlogsDetailsComponentFrontend/src/app/components/blogs/blogs-details/blogs-details.component.ts:1

…and 163 more.

Was this page helpful?

Download as PDF