mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-4152] Updated folder structure of core docs (#4415)
* [ADF-4152] Moved core library docs into subfolders * [ADF-4152] Moved core library docs into subfolders * [ADF-4152] Manual fixes to core doc file links * [ADF-4152] Further automatic + manual link tidying
This commit is contained in:
committed by
Eugenio Romano
parent
285e56e9fb
commit
5fc05da7aa
95
docs/core/services/notification.service.md
Normal file
95
docs/core/services/notification.service.md
Normal file
@@ -0,0 +1,95 @@
|
||||
---
|
||||
Title: Notification Service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-06-08
|
||||
---
|
||||
|
||||
# [Notification Service](../../../lib/core/services/notification.service.ts "Defined in notification.service.ts")
|
||||
|
||||
Shows a notification message with optional feedback.
|
||||
|
||||

|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **dismissSnackMessageAction**()<br/>
|
||||
dismiss the notification snackbar
|
||||
- **openSnackMessage**(message: `string`, config: `number|MatSnackBarConfig` = [`NotificationService`](../../core/services/notification.service.md)`.DEFAULT_DURATION_MESSAGE`): [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>`<br/>
|
||||
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`](https://material.angular.io/components/snack-bar/overview)`<any>` - Information/control object for the SnackBar
|
||||
- **openSnackMessageAction**(message: `string`, action: `string`, config: `number|MatSnackBarConfig` = [`NotificationService`](../../core/services/notification.service.md)`.DEFAULT_DURATION_MESSAGE`): [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>`<br/>
|
||||
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`](https://material.angular.io/components/snack-bar/overview)`<any>` - Information/control object for the SnackBar
|
||||
|
||||
## Details
|
||||
|
||||
The [Notification Service](notification.service.md) is implemented on top of the Angular Material Design snackbar.
|
||||
Use this service to show a notification message, and optionally get feedback from it.
|
||||
|
||||
```ts
|
||||
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');
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
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');
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
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');
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user