goodeggs / angular-cached-resource

An AngularJS module to interact with RESTful resources, even when browser is offline
MIT License
216 stars 29 forks source link

Add option for use offline cache only #18

Open jojoob opened 10 years ago

jojoob commented 10 years ago

It would be nice to have an option to switch off passing the request to the server when the resource is always cached. In case of resource is already cached just return this cached data. If the resource isn't cached at this moment the promise rejects. This could be used to avoid unnecessary data transfer if you know the resource hasn't changed.

For example I developing a mobile web application where all the content get downloaded once and following operating completely with offline data even when internet connection is available. I do this for don't charge the users traffic volume to much. Finally the app communicates with the server first when the user wishes to upload the changes.

hazeledmands commented 10 years ago

:+1: This is a great idea. :+1: Added to the roadmap.

jojoob commented 10 years ago

Maybe you can give me some hints how to implement this to have a chance to help you. Currently I read and try to understand the code. But sadly I've never worked with coffeescript before and also AngularJS is relative new to me.

hazeledmands commented 10 years ago

Oh awesome, I can't wait to see what you come up with!

Not sure where to start with hints, except maybe try running the specs? If you have any specific questions, I'll be happy to help you out with them :)

beliz commented 10 years ago

Exactly What I need !

@jojoob Are you still working on it ?

jojoob commented 10 years ago

I'm very sorry but I don't followed up this solution. I decided to use restangular with angular-cache module for my project instead.

hazeledmands commented 10 years ago

Glad to hear there's interest in this feature! I guess I'll work on it next :)

PureSpider commented 10 years ago

This would be a much appreciated feature, I am currently building an app which will have offline support, thus I would only need to make an actual request when the phone reports as being online. If not, I can just use the cached data without even trying to make a request.

finitha commented 7 years ago

Hi, I'm still using your lib for my app, and I would like to know if you can give me some help/tip to work into this feature ? :)