Impossible to do an http request from the template



Something make me crazy. The code I give is wotking in a sample project but not when the same code is implemented in the template.

I get this error : core.js:6210 ERROR Error Code: undefined Message: Failed to execute 'open' on 'XMLHttpRequest': Invalid URL

I use the exact same code than here :

The code of my project on Dropbox : URL : http://localhost:3000/#/app/users/userlist

Any idea ?




Please look following:

file: app.interceptor.ts

line: req = req.clone({url: this.config.baseURLApi + req.url});

You need to change config.baseURLApi to send the request to another domain.

Best Regards



There is no file 'app.interceptor.ts'.

I don't understand why I can't use an url from my service to call a webapi. I copy/paste the code in pastbin, the exact same code in a blank project (ng new myproject) and works fine. The same code used from the template generate an error : ERROR Error Code: undefined Message: Failed to execute 'open' on 'XMLHttpRequest': Invalid URL

The code is here :

Look the small project here :

Launch it and go to : http://localhost:3000/#/app/users/userlist You will see the error


User profile image

Hi Kris,

We are investigating your request and try to come back to you as soon as possible!




The exact same code (I just copied the files) in an another template (one of your competitor)is working fine.

Have a nice day,


Hi Kris,

directory of app.interceptor.ts file:

src -> app -> app.interceptor.ts

Please read about HTTP interceptor here:

In sing-app-angular template, there is a configuration file for host API. Open the project and take a look for the app.config.ts file, inside of that file you see the baseURLApi variable which is responsible for all requests.

To send a request to the external api, you can try the following:

  • change baseURLApi variable's value to your external api

for ex: baseURLApi=''

Best regards!



I don't want a single baseURLApi for all requests because there will be more than one WebApi. I just want use the service the "normal" way. I suppose you didn't download the sample, I have a service and I want use the URL from the service.

Best regards,


Hi, We already downloaded and checked your code, actually, everything is okay. At the moment template has a configuration to send requests to only one API. But, you can make any customization to your code, off course you can send requests to multiple WebApi as much as you want. To do that, change just configuration and you need to have an understanding of interceptors.

We are sorry, we could not help to make any customization to your code. If you have any problems feel free to ask.


Best Regards!

Cookie Consent

By continuing to browse or by clicking 'OK', you agree to the storing of cookies on your device to enhance your site experience and for analytical purposes. To learn more about how we use cookies, please see our cookies policy.