alfresco-ng2-components/docs/core/notification.service.md
Andy Stark 28ba09897e [ADF-2764] Added new type linker features and applied them to core docs (#3442)
* [ADF-2764] Added basic support for composite and external types

* [ADF-2764] Added new type linker features and applied to core docs
2018-06-06 13:21:31 +02:00

2.6 KiB

Added, Status
Added Status
v2.0.0 Active

Notification Service

Shows a notification message with optional feedback.

Notification Service screenshot

Class members

Methods

  • openSnackMessage(message: string = null, millisecondsDuration?: number = null): MatSnackBarRef<any>
    Opens a SnackBar notification to show a message.
    • message: string - The message (or resource key) to show.
    • millisecondsDuration: number - (Optional) Time before notification disappears after being shown
    • Returns MatSnackBarRef<any> - Information/control object for the SnackBar
  • openSnackMessageAction(message: string = null, action: string = null, millisecondsDuration?: number = null): MatSnackBarRef<any>
    Opens a SnackBar notification with a message and a response button.
    • message: string - The message (or resource key) to show.
    • action: string - Caption for the response button
    • millisecondsDuration: number - (Optional) Time before the notification disappears (unless the button is clicked)
    • Returns MatSnackBarRef<any> - Information/control object for the SnackBar

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');
            });
    }
}