alfresco-ng2-components/docs/core/notification.service.md
Eugenio Romano 368f949fc4
[no-issue] general fix e2e and unit test (#3903)
* add missing import
remove creation folder in redirect test in main folder
fix update script
update node js-api to last alpha before to install
improve share dialog test

* update gnu

* fix notification and search e2e

* change name compatible with file name

* improve failing test to avoid cdk overlay problems

* [ADF-3561] fix Outcome not translatable

* increase sleep in user permission
checklist missing uppercase
comment possible different value in test due time

* improve document list actions

* improve document list action test

* tag refresh bbefore next test
comment possible value due the time
2018-10-20 18:16:44 +01:00

3.4 KiB

Added, Status, Last reviewed
Added Status Last reviewed
v2.0.0 Active 2018-06-08

Notification Service

Shows a notification message with optional feedback.

Notification Service screenshot

Class members

Methods

  • openSnackMessage(message: string, config: number|MatSnackBarConfig = NotificationService.DEFAULT_DURATION_MESSAGE): MatSnackBarRef<any>
    Opens a SnackBar notification to show a message.
    • message: string - The message (or resource key) to show.
    • config: number|MatSnackBarConfig - Time before notification disappears after being shown or MatSnackBarConfig object
    • Returns MatSnackBarRef<any> - Information/control object for the SnackBar
  • openSnackMessageAction(message: string, action: string, config: number|MatSnackBarConfig = NotificationService.DEFAULT_DURATION_MESSAGE): 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
    • config: number|MatSnackBarConfig - Time before notification disappears after being shown or MatSnackBarConfig object
    • Returns MatSnackBarRef<any> - Information/control object for the SnackBar
  • dismissSnackMessageAction()
    dismiss the notification 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');
            });
    }
}
import { NotificationService } from '@alfresco/adf-core';
import { MatSnackBarConfig } from '@angular/material';

export class MyComponent implements OnInit {

    snackBarConfig: MatSnackBarConfig = new MatSnackBarConfig();

    constructor(private notificationService: NotificationService) {
    }

    ngOnInit() {
        this.notificationService
            .openSnackMessageAction('Do you want to report this issue?', 'send', snackBarConfig)
            .afterDismissed()
            .subscribe(() => {
                console.log('The snack-bar was dismissed');
            });
    }
}