myHeaders = new Headers({
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': '*',
'Access-Control-Allow-Credentials': '*',
'Access-Control-Expose-Headers': 'x-access-token',
'Authorization': 'Bearer ' + localStorage.getItem('token')
});
options = new RequestOptions({
headers: this.myHeaders
});
constructor(
private http: Http,
private authenticationService: AuthenticationService) {
}
getPaises() {
return this.http.get(this.userUrl + "/pesquisar", this.options)
.map((response: Response) => {
console.log("Pesquisou por todos " + response.status);
return response.json();
}).catch((error:any) => Observable.throw(error.json().error || 'Erro em buscar países ' + console.log(this.options)));
}
O que pode ser ?
Do lado do servidor está ok.