I couldn't find anything in the docs about invalidation. Is anybody aware of how to force invalidation of an object/collection?
e.g.: PUT /users/123 => delete from cache the user "123"
It looks alright though in terms of what it offers on first inspection though. It does solve some problems that I have found myself having to solve in a similar manner with homebrewed code & structure.
Just one question, does it have the feature to add offline custom methods to the model e.g. I want to add instance calculateAge() for each User ? I couldn't find it in the guides.
Angular-RestMod provides it > https://github.com/platanus/angular-restmod#custom-methods
(basically we use node on the server and many times we just want to reuse the same server side methods on the client)
* multi-user access
* realtime updates to connected clients, and
* offline editing and sync?
When multiple users access a resource, you have to consider things like consistency issues (making sure all users see the same changes applied in the same order). Also other stuff would be nice like access control (perhaps integrated with the publishing user's address book) as well as subscriptions notifications when something changes.Does anyone know of a library that implements that? It took me a couple years to get everything right in my own library.
Another option is too use web sockets or a pub/sub messaging service to notify all clients of changes to data, and each client can decide what it wants to do at that point (refresh data, get the changes, etc.). You could implement your own 3-way databinding this way.
Angular-data doesn't support offline editing and sync out of the box right now, but I'm considering writing an adapter that combines the existing http and localStorage adapters into one that supports offline editing and sync. Or you could make your own.
You might want to have a look at http://pouchdb.com/ but I don't know how (or if) that handles consistency issues.
Can someone give me an example of this? I just use $http and populte the $scope models in callbacks so I don't really recognize the problem.
A scope only extends as far as a particular controller/service. If you wanted every controller/service to have access to that user's data (eg. that user's ID), you would create a service that would store that data, and then inject that service into each place you need to access the data.
You have to reload all the data each time you go to this view (if you navigate back to previous page it has to reload).
You have to reload data that is used on multiple pages. eg. products, categories, tags and especially user
The most common solution is to start stuffing things in $rootScope, after that you stuff it in localStorage using angular-cache (which is great).
My own system keeps the user's menu in cache, so it loads near instantly when they come back to the site (still logged in). It invalidates the cache if the user or app version has changed.
The cool thing about angular-data, is that stuff it available, even when the browser is offline and you do a refresh.
It seems more meant ot be used as a caching layer that would wrap you webservice access services.
I tried following the advice to upgrade to 3.x when it appeared on the API docs, but it broke my app completely which, after spending 5 minutes reading the 3.x branch's docs made complete sense - you're going for something much larger here.
I haven't personally played with Ember yet, but this seems like it might be inspired by Ember Data? Is that right? From what I hear, that's one of the many thing that Ember has gotten really right.
Thanks again!
Angular-data (at 1.0.0-rc.1 right now) is a full-fledged data store and resource manager.
You could provide a generic js library with a way to opt-in angularjs,that way,your data access layer isnt tied to a presentation framework.
Can I use this lib with Backbone or React ? why this fixation on making everything depend on angular ? like jQuery in the past ? are we destined to repeat the same mistakes over and over again in the client js world ?
This is just Angular-specific boilerplate to access window/$window and add/retrieve objects without writing a bunch of low-level services. Backbone and Ember already have these model layers but they come with heavy wrappers and getter/setter methods, and the author said he wanted to keep these as POJO objects (which Angular is loved for) without polluting them with ride-along getter/setter methods.
Plan on visiting the ATM machine later?
This definitely warrants some thought. The next time I write a non-trivial application in a framework other than Angular then this will move up on my priority list. Or perhaps when the community wills it into existence :)
Think of this as client side ActiveRecord. It handles queries, relations, and syncing with the back end.
Will get it back though.