fix($resource): support escaping of ':' in resource url

So one can how define cors/jsonp resources with port number as:

resource.route('http://localhost\\:8080/Path')
This commit is contained in:
Igor Minar
2011-12-12 13:38:50 -08:00
parent a4fe51da3b
commit 6d6f875345
2 changed files with 9 additions and 3 deletions

View File

@@ -1,16 +1,15 @@
'use strict';
function Route(template, defaults) {
this.template = template = template + '#';
this.defaults = defaults || {};
var urlParams = this.urlParams = {};
forEach(template.split(/\W/), function(param){
if (param && template.match(new RegExp(":" + param + "\\W"))) {
if (param && template.match(new RegExp("[^\\\\]:" + param + "\\W"))) {
urlParams[param] = true;
}
});
this.template = template.replace(/\\:/g, ':');
}
Route.prototype = {