How to integrate Angular-Cache with Restangular

210 views
Skip to first unread message

Ronneil Camara

unread,
Mar 13, 2015, 1:03:07 AM3/13/15
to angula...@googlegroups.com
Hi,

I just found this when I was reading http://jmdobry.github.io/angular-cache/installation.html

I'm currently using Restangular and I have this code to turn on caching.

Here is an example Restangular code that I use in my application but there are more.

            DataService.setDefaultHttpFields({cache: true});
            DataService.one('worlds').customGET('', { 'token' : $scope.userData.bearerToken }).then(function(res) { ........ })

How will I use AngularCache with it so I can expire the cached data?

Thanks,

Neil

Jason Dobry

unread,
Mar 15, 2015, 10:20:35 PM3/15/15
to angula...@googlegroups.com
Apart from setting a default $http cache as described in the Angular docs, I don't know, as I have never used Restangular.

Ronneil Camara

unread,
Mar 18, 2015, 1:46:59 AM3/18/15
to angula...@googlegroups.com
I was able to figure it out using Restangular's http interceptor. I can now remove cache by constructing the params captured by interceptor and using cacheFactory's .remove(url) function

Jason Dobry

unread,
Mar 30, 2015, 12:15:49 PM3/30/15
to angula...@googlegroups.com
ngResource is now officially support in 4.1.0
Reply all
Reply to author
Forward
0 new messages