I have a parent component with the following function:
@ViewChild('currentTab') currentTab: ChildComponent;
nextTab(): void {
if (this.currentTab.save()) {
this.activeIndex++;
}
}
And the following method on the child component:
save(): boolean {
return this.confirmationService.confirm({
message: 'Are you sure?',
accept: () => true,
reject: () => false
});
}
The problem: The conditional in the parent component doesn't wait for an answer, it gets as 'true', doing the this.activeIndex++;
. What am I doing wrong?
Thanks in advance.