DEV Community

Discussion on: How to cache HTTP requests in Angular

Collapse
 
bradtaniguchi profile image
Brad

I struggled figuring this out for at least 1 month when I started with Angular. I looked up a million different approaches and they all were "ugly" or didn't work how I wanted.

I eventually stumbled upon the same solution you gave and found it is hands down the easiest and best way to cache http-requests.

Hopefully this article helps out those out there who need this!

Another cool feature of this approach is it shares the ongoing request with all the subscribers, so if 10 "subscribers" show up asking for this data you still make 1 request, and pass the same data to everyone 😄

Collapse
 
bartosz_io profile image
Bartosz Pietrucha

🎉🎉🎉