NotificationService
NotificationService
Provides toast notification functionality.
Example
class MyComponent {
constructor(private notificationService: NotificationService) {}
save() {
this.notificationService
.success(_('asset.notify-create-assets-success'), {
count: successCount,
});
}
}
## Signature
```TypeScript
class NotificationService {
constructor(i18nService: I18nService, resolver: ComponentFactoryResolver, overlayHostService: OverlayHostService)
success(message: string, translationVars?: { [key: string]: string | number }) => void;
info(message: string, translationVars?: { [key: string]: string | number }) => void;
warning(message: string, translationVars?: { [key: string]: string | number }) => void;
error(message: string, translationVars?: { [key: string]: string | number }) => void;
notify(config: ToastConfig) => void;
}
Members
constructor
(i18nService: I18nService, resolver: ComponentFactoryResolver, overlayHostService: OverlayHostService) => NotificationService
success
(message: string, translationVars?: { [key: string]: string | number }) => void
info
(message: string, translationVars?: { [key: string]: string | number }) => void
warning
(message: string, translationVars?: { [key: string]: string | number }) => void
error
(message: string, translationVars?: { [key: string]: string | number }) => void
notify
(config: ToastConfig) => void
NotificationType
The types of notification available.
Signature
type NotificationType = 'info' | 'success' | 'error' | 'warning'
ToastConfig
Configuration for a toast notification.
Signature
interface ToastConfig {
message: string;
translationVars?: { [key: string]: string | number };
type?: NotificationType;
duration?: number;
}
Members
message
string
translationVars
{ [key: string]: string | number }
type
NotificationType
duration
number