Search code examples
angularnotificationsng-zorro-antd

how to close NzNotificationService notification popup


I am using NG-ZORRO Notification

I have an angular code

this.notif = this.notification.create(
   'success',
   'Notification',
   'test message'
);

I could not find any api like .close()

But the notification shows for 4 seconds, within that duration the user performed another action

Therefore I want to close it, any idea we can force close it ?


Solution

  • The docs you linked mention Methods for destruction are also provided:

    and then they say to use:

    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 create method)