diff options
| author | Fredrik Bonander | 2013-01-23 10:53:49 +0100 |
|---|---|---|
| committer | Misko Hevery | 2013-02-14 14:43:55 -0800 |
| commit | b7e1fb0515798e1b4f3f2426f6b050951bee2617 (patch) | |
| tree | f3d66cc9a9a1cdf818ae9d404dfba10f25b55c0f /test | |
| parent | 755beb2b66ce9f9f9a218f2355bbaf96d94fbc15 (diff) | |
| download | angular.js-b7e1fb0515798e1b4f3f2426f6b050951bee2617.tar.bz2 | |
fix(resource): 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.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ngResource/resourceSpec.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ngResource/resourceSpec.js b/test/ngResource/resourceSpec.js index d0bcbefc..1edb5a95 100644 --- a/test/ngResource/resourceSpec.js +++ b/test/ngResource/resourceSpec.js @@ -129,6 +129,18 @@ 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(':relativePath'); + $httpBackend.expect('GET', 'data.json').respond('{}'); + R.get({ relativePath: 'data.json' }); + }); + + it('should handle + in url params', function () { + var R = $resource('/api/myapp/:myresource?from=:from&to=:to&histlen=:histlen'); + $httpBackend.expect('GET', '/api/myapp/pear+apple?from=2012-04-01&to=2012-04-29&histlen=3').respond('{}'); + R.get({ myresource: 'pear+apple', from : '2012-04-01', to : '2012-04-29', histlen : 3 }); + }); + it('should encode & in url params', function() { var R = $resource('/Path/:a'); |
