From 610ab45c84e4b9b4a96aba8fd731279b85bb1e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juha=20Syrj=C3=A4l=C3=A4?= Date: Fri, 7 Dec 2012 20:09:42 +0200 Subject: [PATCH 1/2] Document port number escaping in URL for $resource Related to issues #1664, #1243 and #942. Also fixed one typo. --- src/ngResource/resource.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index 4c2a8dc1a6fa..3b5e08d2b745 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -19,11 +19,13 @@ * the need to interact with the low level {@link ng.$http $http} service. * * @param {string} url A parameterized URL template with parameters prefixed by `:` as in - * `/user/:username`. + * `/user/:username`. If you are using URL with a port number (e.g. `http://example.com:8080/api`), + * you'll need to escape colon character before the port number, like this: + * `$resource('http://example.com\\:8080/api')`. * * @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in * `actions` methods. If any of the parameter value is a function, it will be executed every time - * when a param value needs to be obtained for a request (unless the param was overriden). + * when a param value needs to be obtained for a request (unless the param was overriden). * * Each key value in the parameter object is first bound to url template if present and then any * excess keys are appended to the url search query after the `?`. @@ -229,7 +231,7 @@ angular.module('ngResource', ['ng']). }; /** - * We need our custom mehtod because encodeURIComponent is too aggressive and doesn't follow + * We need our custom method because encodeURIComponent is too aggressive and doesn't follow * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path * segments: * segment = *pchar From 5817d1123dc85aaa3dd6438d170f3897d3d7dfcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juha=20Syrj=C3=A4l=C3=A4?= Date: Fri, 7 Dec 2012 20:57:00 +0200 Subject: [PATCH 2/2] Fix grammar. --- src/ngResource/resource.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index 3b5e08d2b745..dde7f2c075cc 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -19,9 +19,9 @@ * the need to interact with the low level {@link ng.$http $http} service. * * @param {string} url A parameterized URL template with parameters prefixed by `:` as in - * `/user/:username`. If you are using URL with a port number (e.g. `http://example.com:8080/api`), - * you'll need to escape colon character before the port number, like this: - * `$resource('http://example.com\\:8080/api')`. + * `/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')`. * * @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in * `actions` methods. If any of the parameter value is a function, it will be executed every time