简体   繁体   中英

Ratp get angular5

I have a little problem, I can't get the data via the link web 在此处输入图片说明

I use Angular5

ratp.service.ts

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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