192
rated 0 times
[
196]
[
4]
/ answers: 1 / hits: 26853
/ 8 Years ago, thu, november 3, 2016, 12:00:00
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?
More From » angular