we are using the Ionic framework and AngularJS to create a mobile app with phone gap build. We have a call to our api to get an array of items using $http.get, we are adding an Etag in the header if we already have data in cache. If the data on the server has not changed we get a 304 error which is ok. We are having trouble modifying the data property on the response object form the server to our chached data in local storage.
Any help is appreciated. Thanks
return $http({
method: 'GET',
url: 'http:example.com',
params: params,
headers: customHeader
})
.success(function(data, status, headers, config) {
// do some stuff
})
.error(function(data, status, headers, config) {
if(status == '304') {
alert('this data has not changed');
data = chachedData
// change data to chached data??
}
});