diff options
| author | Leandro Ostera | 2013-05-14 02:41:01 -0300 | 
|---|---|---|
| committer | Pete Bacon Darwin | 2013-07-12 10:47:46 +0100 | 
| commit | b94ca12fa0b027d8592f5717e038b7b116c59384 (patch) | |
| tree | 4e0172b8e9e042a793cb835132067d1deea9067c /src/ngResource | |
| parent | 22a9b1ac07f98d07e1e5d71ce961411b5fa9b42d (diff) | |
| download | angular.js-b94ca12fa0b027d8592f5717e038b7b116c59384.tar.bz2 | |
feat($resource): support an unescaped URL port
The colon character is used to identify parameters in $resource.
This meant that we had to escape the colon used in a port.
It turns out that this is not necessary if we assume that parameter
names cannot consist of only digits.
If the parameter consists only of numbers, then it's a port.
Closes #2778
Diffstat (limited to 'src/ngResource')
| -rw-r--r-- | src/ngResource/resource.js | 5 | 
1 files changed, 2 insertions, 3 deletions
| diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index 827886a3..2df593c1 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -31,8 +31,7 @@   *   * @param {string} url A parametrized URL template with parameters prefixed by `:` as in   *   `/user/:username`. If you are using a URL with a port number (e.g. - *   `http://example.com:8080/api`), you'll need to escape the colon character before the port - *   number, like this: `$resource('http://example.com\\:8080/api')`. + *   `http://example.com:8080/api`), it will be respected.   *   *   If you are using a url with a suffix, just add the suffix, like this:   *   `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json') @@ -345,7 +344,7 @@ angular.module('ngResource', ['ng']).          var urlParams = self.urlParams = {};          forEach(url.split(/\W/), function(param){ -          if (param && (new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) { +          if (!(new RegExp("^\\d+$").test(param)) && param && (new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) {                urlParams[param] = true;            }          }); | 
