I hope this helps you . ngOnInit() was ok to make the api call. I didn't have clear picture of subscribe function . I had to do couple of complex calculation in my typescript file before rendering in the UI. I should be doing this in the subscribe method only. not to assign with a global variable and do a dot operator and expect things to work like charm. I found that until you have listener subscribe does not hold data for your. Meaning if you have large json with nested elements you have to do this.data.innerdata.finalvalue in the subscribe method instead pass that to method and do all the fun stuffs. Pass your information to initData(data) and do all calculation and do the rendering.
How do I create a dashboard layout (or apply a dashboard commercial template) on a project from angular-cli?
By : Miguel_Leal
Date : March 29 2020, 07:55 AM
it fixes the issue Do I need to have a main component (like AppComponent) to show everything inside of it? Or can I have multiple components and its tags defined in the index.html? You need to think of these parts of your page as components. When you are going to do it in the frameworks/libraries like Angular, React or Vue, all of the HTML generation becomes responsibility of framework. So your HTML will have bare minimum markup and load all the basic stuff; just like you mentioned in the first code sample.