From 06ed8ef0127bf80610eba17b5021d1f483d0b0bf Mon Sep 17 00:00:00 2001 From: Fredrik Bonander Date: Fri, 21 Sep 2012 13:39:45 +0200 Subject: fix($resource): Route constructor, updated RegExp Update RegExp to allow urlParams with out leading slash (/). - Will allow reoucese to be loaded from a relative path Example: var R = $resource(':path'); R.get({ path : 'data.json' }); Example usage: Load resources in applications not using webserver, ie local webapp in on a tablet.--- src/ngResource/resource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ngResource') diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index 7e26a6a4..549226a2 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -290,7 +290,7 @@ angular.module('ngResource', ['ng']). this.defaults = defaults || {}; var urlParams = this.urlParams = {}; forEach(template.split(/\W/), function(param){ - if (param && template.match(new RegExp("[^\\\\]:" + param + "\\W"))) { + if (param && (new RegExp("((\\w|\\/|^)(?!\\\\:" + param + ")):" + param + "\\W")).test(template)) { urlParams[param] = true; } }); -- cgit v1.2.3