0
Good morning guys, I have the following problem, I have a very simple api working API for testing. When I make a request get by Angular the return gives 200, bringing the result, but I can not load this result inside the Angular. See how I did:
//arquivo login.component
ngOnInit() {
this.getValues();
}
getValues(): void {
this.authService.getValues()
.subscribe(dados => {
console.log(dados)
});
}
in the service file.
getValues(){
return this.http.get('http://newageapi.us-east-2.elasticbeanstalk.com/api/values');
}
This is the result in Fiddler:
This is the error in Firefox Browser
I followed the example of the angular Hero project.io Does anyone know what it can be?
So Leonardo, the mistake is clear: Blocked cross-origin request, This is a mistake of
CORS
, that is, you are not allowed to access this data. There is a question that will help you to better understand it here: https://answall.com/questions/318049/problema-com-o-cors-no-angular-5– LeAndrade
Yes, but the Cors of the api is releasing all accesses, both in the origins and the verbs. If you were really blocking you wouldn’t return 200 to get, do you agree? Even it sends an OPTIONS and then sends a GET returning the data. Postman works normally. I did the proxy and tmb didn’t work.
– Leonardo