Message

API#

NzMessageService#

This components provides some service methods, with usage and arguments as following:

  • NzMessageService.success(content, [options])
  • NzMessageService.error(content, [options])
  • NzMessageService.info(content, [options])
  • NzMessageService.warning(content, [options])
  • NzMessageService.loading(content, [options])
Argument Description Type Default
content The content of message string | TemplateRef<void> -
options Support setting the parameters for the current message box, see the table below object -

The parameters that are set by the options support are as follows:

Argument Description Type
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

Methods for destruction are also provided:

  • message.remove(id) // Remove the message with the specified id. When the id is empty, remove all messages (the message id is returned by the above method)

Global Configuration#

You can use NzConfigService to configure this component globally. Please check the Global Configuration chapter for more information.

Argument Description Type Default
nzDuration Duration (milliseconds), does not disappear when set to 0 number 3000
nzMaxStack The maximum number of messages that can be displayed at the same time number 7
nzPauseOnHover Do not remove automatically when mouse is over while setting to true boolean true
nzAnimate Whether to turn on animation boolean true
nzTop Distance from top number | string 24

NzMessageDataFilled#

It's the object that returned when you call NzMessageService.success and others.

export interface NzMessageDataFilled {
  onClose: Subject<false>; 
}