revert: fix($resource): Route constructor, updated RegExp

This reverts commit 06ed8ef012.

The reverted commit causes regressions. See comments in the PR:
https://github.com/angular/angular.js/pull/1402#issuecomment-12575399
This commit is contained in:
Igor Minar 2013-01-22 16:30:35 -08:00
parent 3c2e1c5e4d
commit ffe5e01584
2 changed files with 1 additions and 7 deletions

View file

@ -290,7 +290,7 @@ angular.module('ngResource', ['ng']).
this.defaults = defaults || {};
var urlParams = this.urlParams = {};
forEach(template.split(/\W/), function(param){
if (param && (new RegExp("((\\w|\\/|^)(?!\\\\:" + param + ")):" + param + "\\W")).test(template)) {
if (param && template.match(new RegExp("[^\\\\]:" + param + "\\W"))) {
urlParams[param] = true;
}
});

View file

@ -129,12 +129,6 @@ 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');