【发布时间】:2020-04-08 10:13:50
【问题描述】:
单击出现的弹出窗口后,我有提交按钮。弹出窗口有一个复选框列表,如果后端响应为 1700,则应检查这些复选框,然后弹出我们应该关闭。 但是调用关闭弹窗的函数是在 setInterval 完成之前调用的。
公共发送应用程序():无效{ if (this.formService.isFormValid(this.formGroup)) {
this.dialogProcessing
= this.dialog.open(FoDialogBankVerificationComponent, {
width: '500px',
disableClose: true,
data: this.checkBoxValues,
});
this.submit()
.pipe(
take(1))
.subscribe(res => {
if (res.id === 1700) {
this.checkBoxValues.forEach((el, index) => {
setInterval(() => {
el.isChecked = true;
}, index * 1500);
});
this.status = res.id;
this.dialogProcessing.close();
}
});
}
}
【问题讨论】:
-
不确定您要完成什么,但看起来您正在搜索
setTimeout(cb:Function, time: number)
标签: angular setinterval