Number of hits to the external API: {{hits}}
Refresh page (perform request)To see factual number of requests, you need to get rid of PWA functionality. To do that hard refresh this page (ctrl + shift + f5) or unregister Service Worker in developer tools.
Note: if multiple users uses this page in the same time, hitCount may be increasing by more then 1 or 2.
Most of the server-side rendered sites have one big problem. APIs are requested twice during initial load. Why? This is how user action flow looks like:
To avoid such repetitive requests, Angular 5 comes with TransferState. This mechanism gives front-end and back-end a possibility to "communicate". In other words, front-end retrieves from the back-end collection of key -> value sets with the data which back-end already retrieved from external services.