@theo4me: “The right way to prefetch data for your angular components/pages” — @theo4me
The right way to prefetch data for your angular components/pagesEver wondered why you load your component and now do API call?
What you might be familiar with is, showing a loader after rendering your component and also watching if to hide or show a page loader, or have a user/client asked this question
Why are we showing loader after the page has loaded, canâ€™t it show my data once, check this wordpress site, itâ€™s loading the data inÂ ActionNo Handling: The component is loaded, the data loading from API is called to get the data needed for our page or component useful. Why move to a page when the data needed for the page to be useful to users is not loaded?
Loader: You need to manage a loader variable to toggle the view when the data is loaded or not if the data is scattered around the page, you use data all over to toggle the visibility of each. What about having a SINGLE Navigation Event router loader and you donâ€™t bother if to watch for a variable to toggle visibility?
Itâ€™s preferable to pre-fetch data from the server so itâ€™s ready the moment the route is activated. This also allows you to handle errors before routing to the you are pleased with the above concerns, you can continue ğŸ˜‰
What we are going to do is create the above application used in describing resolvers
Create an angular…