To add caching inside http is pretty straight forward. ( by passing cache=true )
http://docs.angularjs.org/api/ng.$http has Cache option.
How do I add simila
I'm using angular-resource 1.5.5 and set my code up the following way:
Set action as query, and since the "query" action is expecting a response deserialized as an array, isArray will need to be explicitly set to true. My understanding is by default ngResource actions expect objects except query. See here
Controller
angular.module("app")
.controller('myCtrl',['$scope','myService',function($scope, myService) {
$scope.myData= myService.myResource.query();
}]);
Service
angular.module('app')
.factory('myService',['$resource',function($resource){
var baseUrl = 'http://www.MyExample.com/';
return{
myResource:$resource(baseURL + '/myEndpoint/:id', {id:'@id'},{
'query':{
method:'GET',
cache:'true',
isArray:true
}}),
}
}]);