I'm trying to constantly loop through an array, update the values in it, and when the array length is reached start the loop over. It's currently preventing the page from loading the from loading and is consoling logging much faster than the timeout should allow. How can I stop the loop from preventing page load?
public imgArray: Array<boolean> = [true, false, false, false]
ngOnInit() {
this.imgCycle();
}
imgCycle() {
let i = 0;
while (true) {
setTimeout(function () { this.imgArray[i] = true }, 10000);
console.log(this.imgArray)
if (i == this.imgArray.length) {
i = 0
continue;
}
i++
}
}