angular 2 test URL differentiates from web API URL

Multi tool use
angular 2 test URL differentiates from web API URL
I have an angular-cli project, embedded in visual studio 2017. By running vs project the angular project is being served and everything works.
then when I want to test the angular project with ng test
, it will be served on http://localhost:9876
but API is unavailable on this URL.
ng test
http://localhost:9876
Web API URL is http://localhost:42339/
. and test fails because request goes to http://localhost:9876
. I changed the service URLs
http://localhost:42339/
http://localhost:9876
getTagData(): Observable<any> {
return this.adminBaseService.get(`http://localhost:42339/api/admin/Tags/GetTags`);
}
but it makes calls to http://localhost:9876
http://localhost:9876
Any help?
I have services for components and call backend through component, then service and then c# api @mohammad-ali
– unos baghaii
Jul 1 at 7:19
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
I think you should define route in angular project. this url is for backend. you need define a component and service for http. and use this service in component. then define a route for the component.
– Mohammad Ali
Jul 1 at 7:04