For questions about ngoninit, a lifecycle hook that is called after Angular has initialized all data-bound properties of a directive.
i have a menu bar that contain a list of menus loaded from express api and every menu is referenced …
angular routerlink ngoninitHomeComponent ngOnInit() { console.log('loaded'); this.retrieveData(); } retrieveData() { // this.dataService.getData().subscribe(...); } I am retrieving data when the component loads. …
angular ngoninit lifecycle-hook