繁体   English   中英

拉特得到角5

[英]Ratp get angular5

我有一个小问题,我无法通过链接网络获取数据 在此处输入图片说明

我使用Angular5

维修服务

getDatas(){
    const url = "https://data.ratp.fr/explore/dataset/liste-des-commerces-de-proximite-agrees-ratp/api/?disjunctive.code_postal&sort=code_postal&refine.tco_libelle=Le+Narval";
    const headers = new HttpHeaders()
       .append('Content-Type', 'application/json')
       .append('Access-Control-Allow-Origin', '*')
       .append('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, authorization,Client-Security-Token')
       .append('Access-Control-Allow-Methods', 'GET, PUT, POST, PATCH, DELETE, OPTIONS');

    return this.http.get<any>(url,{headers} ).pipe(map(res => console.log(res)));
}

app.component.ts

test(){
   this.ratp.getDatas().subscribe(res => res);
}

app.component.html

<button (click)="test()">Click</button>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM