如何关闭NzNotificationService通知弹出窗口

问题描述 投票:0回答:2

我正在使用NG-ZORRO通知

我有一个角度代码

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

我找不到像

.close()

这样的API

但是通知显示了 4 秒,在此期间用户执行了另一个操作

因此我想关闭它,我们可以强行关闭它吗?

angular notifications ng-zorro-antd
2个回答
1
投票

您链接的文档提到了

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

0
投票

构造函数(私有通知:NzNotificationService){}

this.notification.remove()

this.notification.remove(id)

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.