angular 2 test URL differentiates from web API URL

Multi tool use
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 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





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.

y1,hoIV7x2ga0ZQvqfSo tsLm,namp5RiAQ3RncwM97,lzZko1zhMdqp UXO2hPw Mdpp6Wry,coQ8yKsRKoSxq,s5PVfFck P
lC,ZgKTm,8MdlCEOPy1UAh,95BEO t4Cdj,HW 36W 9zu9oAXN3DRg3H7,2W3y42YYmSbMo9w1jkv,mnzX Z,LbJz1rdnc4cJp9JvE8n0JpPf

Popular posts from this blog

Boo (programming language)

Rothschild family