Skip to content

Instantly share code, notes, and snippets.

@ipassynk
Created May 13, 2017 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipassynk/f562c773c9e0051a7dbc2e2c37baf87b to your computer and use it in GitHub Desktop.
Save ipassynk/f562c773c9e0051a7dbc2e2c37baf87b to your computer and use it in GitHub Desktop.
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