So I have a custom component with some animations that needs to call changeDectector.detectChanges()
from my childComponent.ts:
public onLoad(): void {
this.startAnimations()
}
private startAnimations(): void {
//.. some animations
this.changeDetector.detectChanges()
}
This was working until I added a ngif to my parent component like this:
<StackLayout *ngIf="isReady">
<ChildComponent></ChildComponent>
</StackLayout>
For some reason when I added the ngif, it's causing the childComponent to call onLoad multipleTimes. So every time I call this.changeDetector.detectChanges(), then the onLoad method is trigger causing a "Maximum call stack size exceeded." Does anyone know what's going on here? and how do I fix it?
Thanks in advance guys!