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.--- test/ngResource/resourceSpec.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/ngResource/resourceSpec.js b/test/ngResource/resourceSpec.js index 33dc6d5b..cf3b886b 100644 --- a/test/ngResource/resourceSpec.js +++ b/test/ngResource/resourceSpec.js @@ -129,6 +129,12 @@ describe("resource", function() { R.get({a: 'doh@fo o', ':bar': '$baz@1', '!do&h': 'g=a h'}); }); + it('should allow relative paths in resource url', function () { + var R = $resource(':a'); + $httpBackend.expect('GET', 'data.json').respond('{}'); + R.get({ a: 'data.json' }); + }); + it('should encode & in url params', function() { var R = $resource('/Path/:a'); -- cgit v1.2.3