I'm implementing functionality in Angular2 that requires the use of setTimeout.
My code:
public ngAfterViewInit(): void {
this.authenticate_loop();
}
private authenticate_loop() {
setTimeout (() => {
console.log("Hello from setTimeout");
}, 500)
}
setTimeout is started by ngAfterViewInit but the loop is only executed once, eg. "Hello fromsetTimeout" is only printed once.
Question: How can I change the code to make the setTimeout work?