diff options
| author | Caitlin Potter | 2014-01-27 14:04:45 -0500 | 
|---|---|---|
| committer | Caitlin Potter | 2014-02-03 11:12:07 -0500 | 
| commit | ce1f1f97f0ebf77941b2bdaf5e8352d33786524d (patch) | |
| tree | be15f6e2395b79dc4348ca7cf5681714e8b4cceb /src/ngResource/resource.js | |
| parent | 8205158e477f1ea235feba3087143e0d3e5e52ec (diff) | |
| download | angular.js-ce1f1f97f0ebf77941b2bdaf5e8352d33786524d.tar.bz2 | |
fix(ngResource): don't append number to '$' in url param value when encoding URI
Previously, if a URL parameter value included a $, it would replace the dollar sign with a literal
'$1' for mysterious reasons. Using a function rather than a replacement string circumvents this
behaviour and produces a more expected result.
Closes #6003
Closes #6004
Diffstat (limited to 'src/ngResource/resource.js')
| -rw-r--r-- | src/ngResource/resource.js | 4 | 
1 files changed, 3 insertions, 1 deletions
| diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index 006f3d37..055f0890 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -387,7 +387,9 @@ angular.module('ngResource', ['ng']).            val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];            if (angular.isDefined(val) && val !== null) {              encodedVal = encodeUriSegment(val); -            url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), encodedVal + "$1"); +            url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), function(match, p1) { +              return encodedVal + p1; +            });            } else {              url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W|$)", "g"), function(match,                  leadingSlashes, tail) { | 
