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.
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
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.