【发布时间】:2017-08-09 15:31:10
【问题描述】:
我有一个返回 json 的 Instagram url (https://www.instagram.com/p/-vSJNUDKKD/?__a=1),但是当我尝试使用 http get 请求调用该 url 时,我得到了整个 html 正文。我在哪里做错了。
public GetItems(url: string) {
return this._http.get(url).map((response: Response) => response.json());
}
public downloadImage(url: string) {
var myresult;
this.GetItems(url + "?__a=1").subscribe((result) => {
myresult = result;
console.log(result);
});
【问题讨论】:
-
尝试设置
content type json -
它在尝试时为我抛出了 CORS 问题
标签: json angular http ionic2 instagram-api