New to Kendo UI for AngularStart a free 30-day trial

Clear All Notifications Programmatically

Updated on Jan 20, 2026

Environment

ProductProgress® Kendo UI® for Angular Notification

Description

How can I clear all notifications programmatically when opening multiple notifications from the service?

This Knowledge Base article also answers the following questions:

  • How do I manage multiple notification instances?
  • How can I batch clear notifications using NotificationRef?
  • What is the best practice for handling many notifications at once?

Solution

To clear all notifications programmatically, save the NotificationRef instances returned by the NotificationService.show method in an array. You can then iterate through the array and call the hide method on each notification to close them all at once.

The following implementation demonstrates this approach:

  1. Create an array to store all NotificationRef instances.

    typescript
    private notificationRefs: NotificationRef[] = [];
  2. Push each new notification reference to the array when creating notifications.

    typescript
    public show(): void {
      const notification = this.notificationService.show({
        content: this.notificationTemplate,
        position: { horizontal: 'right', vertical: 'top' },
        type: { style: 'success', icon: true },
        closable: true,
      });
    
      this.notificationRefs.push(notification);
    }
  3. Iterate through the array and call hide() on each reference to clear all notifications.

    typescript
    public hideAll(): void {
      this.notificationRefs.forEach((notification) => {
        notification.hide();
      });
    
      this.notificationRefs = [];
    }
  4. Clear the array after hiding all notifications to prevent memory leaks.

The array is cleared in the hideAll() method to prevent memory leaks and ensure accurate tracking of active notifications.

The following example demonstrates the complete implementation with multiple notifications opened initially and the ability to clear them all programmatically.

Change Theme
Theme
Loading ...

See Also

In this article
EnvironmentDescriptionSolutionSee Also
Not finding the help you need?
Contact Support