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
| Method | Signature | Returns |
|---|---|---|
goAlert | `goAlert(type: string | 'W' |
goTranslatedAlert | `goTranslatedAlert(type: string | 'W' |
goAlertError | `goAlertError(type: string | 'W' |
Properties
| Property | Type |
|---|---|
_alert | Alerts |
alert | any |
_alertTranslated | AlertsTranslated |
alertTranslated | any |
type | `string |
msg | AlertMsg |
Diagram
mermaidgraph LR Component[Frontend Component] --> Service[AlertsService] Service --> Standard[goAlert()] Service --> Translated[goTranslatedAlert()] Service --> Error[goAlertError()] Standard --> AlertUI[Alert Display] Translated --> AlertUI Error --> AlertUI
Usage
tsimport { 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
AlertsServiceinto components or services that need to trigger alert behavior. - Use
goAlert()for standard alert flows andgoAlertError()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)
AppComponent—Frontend/src/app/app.component.ts:1MrqDetailsComponent—Frontend/src/app/components/MRQ/mrq-details/mrq-details.component.ts:1MrqInquiryComponent—Frontend/src/app/components/MRQ/mrq-details/mrq-inquiry/mrq-inquiry.component.ts:1MrqListComponent—Frontend/src/app/components/MRQ/mrq-list/mrq-list.component.ts:1BillOfMaterialsDetailsComponent—Frontend/src/app/components/bill-of-materials/bill-of-materials-details/bill-of-materials-details.component.ts:1BillOfMaterialsListComponent—Frontend/src/app/components/bill-of-materials/bill-of-materials-list/bill-of-materials-list.component.ts:1BlogPopupComponent—Frontend/src/app/components/blogs/blog-popup/blog-popup.component.ts:1BlogsDetailsComponent—Frontend/src/app/components/blogs/blogs-details/blogs-details.component.ts:1
…and 163 more.
Was this page helpful?