aboutsummaryrefslogtreecommitdiffstats
path: root/src/Resource.js
diff options
context:
space:
mode:
authorAndres Ornelas2010-07-27 10:44:46 -0700
committerAndres Ornelas2010-07-27 10:44:46 -0700
commitb42072733c3afd03a49457d88ffed28ebe55655e (patch)
tree2fa2b8703cdc75fe19a204d2c9677e27d33c8176 /src/Resource.js
parent2f7c538628929888ce7c99b9577e34f8c87211f7 (diff)
parent8ddee9bb25ade2bbe7d57db6353b29867606c184 (diff)
downloadangular.js-b42072733c3afd03a49457d88ffed28ebe55655e.tar.bz2
Merge branch 'master' of github.com:angular/angular.js into future
Diffstat (limited to 'src/Resource.js')
-rw-r--r--src/Resource.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Resource.js b/src/Resource.js
index 6ee0b1cf..f4f26ebd 100644
--- a/src/Resource.js
+++ b/src/Resource.js
@@ -1,3 +1,5 @@
+
+
function Route(template, defaults) {
this.template = template = template + '#';
this.defaults = defaults || {};
@@ -26,6 +28,7 @@ Route.prototype = {
query.push(encodeURI(key) + '=' + encodeURI(value));
}
});
+ url = url.replace(/\/*$/, '');
return url + (query.length ? '?' + query.join('&') : '');
}
};
@@ -91,11 +94,10 @@ ResourceFactory.prototype = {
action.method,
route.url(extend({}, action.params || {}, extractParams(data), params)),
data,
- function(status, response) {
+ function(status, response, clear) {
if (status == 200) {
if (action.isArray) {
- if (action.cacheThenRetrieve)
- value = [];
+ value.length = 0;
foreach(response, function(item){
value.push(new Resource(item));
});
@@ -107,7 +109,7 @@ ResourceFactory.prototype = {
throw {status: status, response:response, message: status + ": " + response};
}
},
- action.cacheThenRetrieve
+ action.verifyCache
);
return value;
};