aboutsummaryrefslogtreecommitdiffstats
path: root/src/ngResource/resource.js
diff options
context:
space:
mode:
authorBenjamín Eidelman2012-08-20 19:47:26 -0300
committerMisko Hevery2012-09-06 16:06:22 -0700
commit4909d1d39d61d6945a0820a5a7276c1e657ba262 (patch)
treea1f54abdd3e0cf28ed32f6f73b6bf6e5da4dd1ce /src/ngResource/resource.js
parent7079ff5eb6c22e8755c11385979d9feaad8c7b9d (diff)
downloadangular.js-4909d1d39d61d6945a0820a5a7276c1e657ba262.tar.bz2
fix($resource): allow falsy values in URL parameters
Close #1212 when a param value was 0 (or false) it was ignored and removed from url. after this fix that only happens if the value is undefined or null.
Diffstat (limited to 'src/ngResource/resource.js')
-rw-r--r--src/ngResource/resource.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js
index cd03d2d2..0a40cedd 100644
--- a/src/ngResource/resource.js
+++ b/src/ngResource/resource.js
@@ -285,7 +285,8 @@ angular.module('ngResource', ['ng']).
params = params || {};
forEach(this.urlParams, function(_, urlParam){
- if (val = (params[urlParam] || self.defaults[urlParam])) {
+ val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
+ if (isDefined(val) && val !== null) {
encodedVal = encodeUriSegment(val);
url = url.replace(new RegExp(":" + urlParam + "(\\W)", "g"), encodedVal + "$1");
} else {