【发布时间】:2018-06-15 11:22:15
【问题描述】:
在我的 Angular 应用程序中,我需要从响应标头中检索位置数据。 服务器 (Nginx) 配置为允许跨源并允许/在标头中公开位置。我可以在 chrome DEV 控制台中看到这一点,但在我的 Angular 应用程序中,我没有看到任何标题数据。
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers:Location, Content-Type
Access-Control-Expose-Headers:Location, Content-Type
这是我的代码 sn-p。
this.httpClient.post( url, {
UserName: username,
Password: password
}
)
.subscribe(
(res: Response) => {
console.log(res.headers);
},
error => {console.log('Error occured::' + error);
}
);
console.log(res.headers) 返回未定义。
这里出了什么问题?
【问题讨论】:
标签: cors angular5 response-headers