aboutsummaryrefslogtreecommitdiffstats
path: root/src/Resource.js
diff options
context:
space:
mode:
authorShyam Seshadri2010-06-23 13:07:31 -0700
committerShyam Seshadri2010-06-23 13:07:31 -0700
commit42257f22af643fc5e91162cc99adeef32916fd28 (patch)
tree85f78cf493e79a44fc02d4749da681296d83dcea /src/Resource.js
parent70c3dc81665191cd065a5303e5e26639a0023a73 (diff)
downloadangular.js-42257f22af643fc5e91162cc99adeef32916fd28.tar.bz2
wilford's changes to serve cached data and then fetch from server if needed / specified
Diffstat (limited to 'src/Resource.js')
-rw-r--r--src/Resource.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Resource.js b/src/Resource.js
index 724121b7..6ee0b1cf 100644
--- a/src/Resource.js
+++ b/src/Resource.js
@@ -94,6 +94,8 @@ ResourceFactory.prototype = {
function(status, response) {
if (status == 200) {
if (action.isArray) {
+ if (action.cacheThenRetrieve)
+ value = [];
foreach(response, function(item){
value.push(new Resource(item));
});
@@ -104,7 +106,8 @@ ResourceFactory.prototype = {
} else {
throw {status: status, response:response, message: status + ": " + response};
}
- }
+ },
+ action.cacheThenRetrieve
);
return value;
};
@@ -135,4 +138,3 @@ ResourceFactory.prototype = {
return Resource;
}
};
-