Closed aimingxu closed 6 years ago
@aimingxu you just losing a this context . There are 2 ways to avoid it
bind this to some variable (old style)
var self = this;
setTimeout(function(){
self.hintService.initialize();
}, 4000);
}
And ES6 one is using lambda(arrow)
setTimeout(() => {
this.hintService.initialize();
}, 4000);
}
@aimingxu
Feels like solved, closing.
I want to auto start the tour after page load without click a button or link. Here is my code: ngAfterContentInit(){ setTimeout(function(){ this.hintService.initialize(); }, 4000); } I got ERROR TypeError: Cannot read property 'initialize' of undefined.