Top "Ngoninit" questions

For questions about ngoninit, a lifecycle hook that is called after Angular has initialized all data-bound properties of a directive.

Angular 2 ngOnInit is not called when routerlink changes

i have a menu bar that contain a list of menus loaded from express api and every menu is referenced …

angular routerlink ngoninit
How do I run a function on ngOnInit() only once and not again upon returning back from another routerLink?

HomeComponent ngOnInit() { console.log('loaded'); this.retrieveData(); } retrieveData() { // this.dataService.getData().subscribe(...); } I am retrieving data when the component loads. …

angular ngoninit lifecycle-hook