Closed ghost closed 11 years ago
Hey,
So I'd use a $cache for this. Do your own implementation for a cache instead of getting one from $cacheFactory and then you could use that.
Basically, Restangular use $http which would always return the stuff in the cache. But, you could (in your cache), every time that someone wants to get something from cache, do the request and once it's resolved, update that cache value, then, next time it's called it'll be updated.
Check http://docs.angularjs.org/api/ng.$cacheFactory to see how $cache interface works.
Hope this works for you!
If you do implement this and you want, you can PR me later and I can add this as a separate JS file as a Restangular plugin :) .
Thanks!!
If you have any other doubt or problem, please post it here!
Restangular handles API consumption as I want, but I need to add some features. I assume that I'll need to create wrapper methods around the Restangular API, but I'd like to get your input on how best to achieve this.