
API#
NzNotificationService#
The component provides a number of service methods using the following methods and parameters:
NzNotificationService.blank(title, content, [options])// Notification without iconNzNotificationService.success(title, content, [options])NzNotificationService.error(title, content, [options])NzNotificationService.info(title, content, [options])NzNotificationService.warning(title, content, [options])
| Argument | Description | Type | Default |
|---|---|---|---|
| title | Title | string |
- |
| content | Notification content | string |
- |
| options | Support setting the parameters for the current notification box, see the table below | object |
- |
The parameters that are set by the options support are as follows:
| Argument | Description | Type |
|---|---|---|
| nzKey | The unique identifier of the Notification | string |
| nzDuration | Duration (milliseconds), does not disappear when set to 0 | number |
| nzPauseOnHover | Do not remove automatically when mouse is over while setting to true |
boolean |
| nzAnimate | Whether to turn on animation | boolean |
| nzStyle | Custom inline style | object |
| nzClass | Custom CSS class | object |
| nzData | Anything that would be used as template context | any |
Methods for destruction are also provided:
NzNotificationService.remove(id)// Remove the notification with the specified id. When the id is empty, remove all notifications (the notification id is returned by the above method)
Global Configuration#
You can use NzConfigService to configure this component globally.
| Parameter | Description | Type | Default |
|---|---|---|---|
| nzDuration | Duration (milliseconds), does not disappear when set to 0 | number |
4500 |
| nzMaxStack | The maximum number of notifications that can be displayed at the same time | number |
8 |
| nzPauseOnHover | Do not remove automatically when mouse is over while setting to true |
boolean |
true |
| nzAnimate | Whether to turn on animation | boolean |
true |
| nzTop | The top of the notification when it pops up from the top. | string |
24px |
| nzBottom | The bottom of the notification when it pops up from the bottom. | string |
24px |
| nzPlacement | Popup position, optional topLefttopRightbottomLeftbottomRight |
string |
topRight |
NzNotificationDataFilled#
It's the object that returned when you call NzNotificationService.success and others.
export interface NzNotificationDataFilled {
onClose: Subject<boolean>;
}




近期评论