Answer the question
In order to leave comments, you need to log in
How to get api data from server in angular 2?
Hello.
I am running server localhost:8488
This is a service with Api data.
Those. localhost:8488/GetUsers returns me an object with users
The problem is that when I write a service in my application on Angular, I make a cross-domain request /
How to solve the problem? Maybe through a proxy?
Answer the question
In order to leave comments, you need to log in
So google how to make your api server able to respond to cross-domain requests...
Here the question is not for angular, if you use $resource it resolves it automatically, but CORS requests must be supported by the API server, it must give the correct answer.
https://docs.angularjs.org/api/ngResource/service/...
https://developer.mozilla.org/en-US/docs/Web/HTTP/...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question