【发布时间】:2020-09-25 12:44:26
【问题描述】:
我有一个具有以下功能的父组件:
@ViewChild('currentTab') currentTab: ChildComponent;
nextTab(): void {
if (this.currentTab.save()) {
this.activeIndex++;
}
}
子组件上的方法如下:
save(): boolean {
return this.confirmationService.confirm({
message: 'Are you sure?',
accept: () => true,
reject: () => false
});
}
问题:父组件中的条件不等待答案,它得到“真”,执行this.activeIndex++;。我做错了什么?
提前致谢。
【问题讨论】:
标签: angular promise observable primeng