I
I
Ivan Damaskin2017-04-20 14:36:59
Angular
Ivan Damaskin, 2017-04-20 14:36:59

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

2 answer(s)
A
Alexander Manakov, 2017-04-20
@gogolor

So google how to make your api server able to respond to cross-domain requests...

V
Vladimir, 2017-04-20
@Casufi

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 question

Ask a Question

731 491 924 answers to any question