consume web service echo in java with angle 2? [closed]

1

Good I am beginning with the web service, create one in java, which I want to connect with angular2, but it throws me an error.

    
asked by Angel Angel 15.04.2017 в 01:03
source

2 answers

1

The problem is because there is a browser protection to consume in other sites, whether different web or domain there are ways to enable it but the easiest thing is to proxy from either the constructor that you are using angular-cli or Webpack of such way that is Localhost: 888 / angular Y Localhost: 888 / javaapi and that will allow you to do the browser Good luck

    
answered by 15.04.2017 в 02:32
1

It is a problem of configuration of the headers. To solve it you have to look for the .htaccess of your server (the API server) and include this line:

Header set Access-Control-Allow-Origin "*"

    
answered by 16.04.2017 в 17:47