Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
interface OnInit {
ngOnInit(): void;
}
class stackoverflow implements OnInit {
async ngOnInit() {
return await new Promise(res => {
setTimeout(() => {
alert('ngOnInit');
res();
}, 2000);
})
}
afterngOnInit() {
alert('should i be called after ngOnInit???');
}
}
let s = new stackoverflow();
s.ngOnInit();
s.afterngOnInit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.