Cache an HTTP ‘Get’ service response in AngularJS?

I want to be able to create a custom AngularJS service that makes an HTTP ‘Get’ request when its data object is empty and populates the data object on success.

The next time a call is made to this service, I would like to bypass the overhead of making the HTTP request again and instead return the cached data object.

Is this possible?

7 Answers
7

Leave a Comment