Announce: angular-cached-resource

65 views
Skip to first unread message

Max Edmands

unread,
Apr 25, 2014, 2:06:14 PM4/25/14
to ang...@googlegroups.com
Hey everyone,

Just a short note to let folks know that we've released an angular module that we've written for our offline-compatible web applications.

It works almost exactly the same way as $resource, but will queue writes and cache responses in localStorage, so if you're offline, you'll still be able to use your app with almost no extra work.
Also, if you do a query-style request (isArray: true), it'll populate the cache for each individual item in the array.

var Article = $cachedResource('article', '/articles/:id', {id: "@id"});
var article1 = Article.get({id: 1});
var article2 = new Article({id: 2, contents: "Lorem ipsum dolor..."});
article2.$save();

I'm curious what you all think of this approach!

Best,
Max
Reply all
Reply to author
Forward
0 new messages