diff options
| author | BenjamÃn Eidelman | 2012-08-20 19:47:26 -0300 | 
|---|---|---|
| committer | Misko Hevery | 2012-09-06 15:49:49 -0700 | 
| commit | 125573602f420a4f3c94cba762f03bff1b936f0c (patch) | |
| tree | 9b61e37488542524e03251d80c1db2cd91c4af54 /src/ngResource | |
| parent | ed5dfbcd66cd72372843cb4f6f5957a7a9e7da79 (diff) | |
| download | angular.js-125573602f420a4f3c94cba762f03bff1b936f0c.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')
| -rw-r--r-- | src/ngResource/resource.js | 3 | 
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 {  | 
