【发布时间】:2021-02-05 00:09:01
【问题描述】:
现在,当我打开网站时,我的对话框就会打开,但我只是想知道如何让对话框只有在 notificationType 等于 1 时才打开。
有多种类型的通知,我只希望在 notificationType 等于 1 时打开对话框,那么如何检查我的 getNotification 调用?任何建议或帮助将不胜感激。
我的 get 调用中可以有多种类型的通知,我想查找所有索引并检查是否有任何 notificationType 1,如果有则显示对话框。如果所有索引中都没有notificationType 1,则不显示对话框。
ngOnInit(): void {
this.notificationService.getNotification().subscribe((response: any) => {
this.broadcastText.next(response);
if(response && response.length){
this.dialog.open(ReleaseDialogComponent, {
data : {notifications: response}
});
}
})
【问题讨论】:
-
...检查响应,看看是否
notificationType === 1,如果是,请致电this.dialog.open? -
嗨..我已经更新了我的问题,希望现在更清楚了。感谢您的反馈。
标签: html angular typescript filter angular-material