mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
1.9 KiB
1.9 KiB
Added, Status
Added | Status |
---|---|
v2.0.0 | Active |
Notification Service
Shows a notification message with optional feedback.
Class members
Methods
openSnackMessage(message: string, millisecondsDuration?: number): MatSnackBarRef<any>
Opens a snackbar notification to show a message.message
- The message to showmillisecondsDuration
- (Optional) Time before notification disappears after being shown
openSnackMessageAction(message: string, action: string, millisecondsDuration?: number): MatSnackBarRef<any>
Opens a snackbar notification with a message and a response button.message
- The message to showaction
- Caption for the response buttonmillisecondsDuration
- (Optional) Time before the notification disappears (unless the button is clicked)
Details
The Notification Service is implemented on top of the Angular Material Design snackbar. Use this service to show a notification message, and optionally get feedback from it.
import { NotificationService } from '@alfresco/adf-core';
export class MyComponent implements OnInit {
constructor(private notificationService: NotificationService) {
}
ngOnInit() {
this.notificationService.openSnackMessage('test', 200000).afterDismissed().subscribe(() => {
console.log('The snack-bar was dismissed');
});
}
}
import { NotificationService } from '@alfresco/adf-core';
export class MyComponent implements OnInit {
constructor(private notificationService: NotificationService) {
}
ngOnInit() {
this.notificationService.openSnackMessageAction('Do you want to report this issue?', 'send', 200000).afterDismissed().subscribe(() => {
console.log('The snack-bar was dismissed');
});
}
}