AngularJS Docs for $ resource say that "if you use a URL with a port number ... it will be respected." But this statement is valid only after version 1.2.0rc1, which is a completely new version with a violation of changes (source) .
There are several ways about this error:
// named parameter $resource('http://example.com:8081', { '8081': ':8081' }); // named parameter $resource("http://example.com:port", { port: ':8081' }); // escaped $resource('http://example.com:8081\:8081');
Choose your poison. But if you cannot change every resource URL in your code, then there is another way. You can fix the error yourself by changing the line of code in angular -resource.min. I describe the process in the Google Group column that I inserted below:
Download angular-resource.js and edit it like this. According to the patch, you should replace line 348 with the following:
if (!(new RegExp("^\\d+$").test(param)) && param && (new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) {
What is it. Just host the file on your own web server and you can enjoy the functionality as if it had never been broken. eight -)
source share