Hiding

You can hide the Notification by defining a delay period before the hiding occurs or by defining a closable Notification component.

Defining a Delay before Hiding

To hide the Notification after a specific time period that is measured in milliseconds, pass a hideAfter duration value to the NotificationService.show method. When the closable property is set to true, the hideAfter property is ignored.

The following example demonstrates how to show an auto-hiding Notification to quickly notify the user about a successful operation.

Example
View Source
Edit In Stackblitz  
Change Theme:

Defining a Closable Notification

To render a dedicated Close button in the Notification content and prevent auto-hiding behavior, set the closable property that is passed to the NotificationService.show method to true.

The following example demonstrates how to show a closable Notification to catch the user attention when, for example, an error has occurred during the execution of the application. The afterHide subscription allows you to execute some functionality after the Notification instance is hidden and the hide animation is over.

Example
View Source
Edit In Stackblitz  
Change Theme:

In this article

Not finding the help you need?