Reputation: 1743
Is it possible to use a file (.js / .json) the angular.js cache for $http.get?
We have an angular application, and we want to download some pages and view them offline. So, the idea is, before downloading, we make all the necessary $http.get calls, and save the responses in some json / js file. When we open the pages offline, we want the $http.get calls to access this file and use it as a cache.
It sounds like it should be possible, but I'm new to angular, so I'm not sure how to configure that.
Upvotes: 0
Views: 829
Reputation: 11
Hey this might help you jsCache
You can store api data in storage of your choice for desired time period you want. Just have an look @ https://github.com/funwithjs/jsCache
Upvotes: 0
Reputation: 10003
You can utilise following techniques:
Besides that:
you can enable caching of $http.get
requests:
$http({ cache: true, url: url, method: 'GET'}).success(...);
you can make use of angular $templateCache
: https://docs.angularjs.org/api/ng/service/$templateCache
Upvotes: 1