I have forEach loop that hides an HTML element after 10 sec. I've put it inside a setTimeout function but it's not waiting for 10 sec, the element is hiding with page load.
Not sure if it is because of Angulars lifecycle looks or forEach loop.
Here is my typescript code
ngAfterViewChecked() {
if(this.on) {
this._notificationsElements.forEach((element) => {
const htmlElement = element.nativeElement as HTMLElement;
setTimeout(htmlElement.setAttribute("style", "display:none;"), 10000);
});
}
}