Changement dans le service appelant l'API C#

pour avoir une conversion du JSON en model Angula
This commit is contained in:
Sébastien André
2019-10-07 15:17:47 +02:00
parent b98adf88ca
commit 11cdcba702
2 changed files with 8 additions and 3 deletions

View File

@@ -1,4 +1,8 @@
export class DropZoneResp { export class DropZoneResp {
constructor(data: any) {
Object.assign(this, data);
}
public Id: number; public Id: number;
public Latitude: string; public Latitude: string;
public Longitude: string; public Longitude: string;

View File

@@ -16,9 +16,10 @@ export class ServiceApi {
return this.http.get<Array<DropZoneResp>>('http://localhost:5000/api/DropZone', { headers: headers }) return this.http.get<Array<DropZoneResp>>('http://localhost:5000/api/DropZone', { headers: headers })
.pipe( .pipe(
map(x => x.map(data => new DropZoneResp(data))), map(response => {
// tap(event => console.log(`fetched coinrankings`)), const details = response.map(data => new DropZoneResp(data));
// catchError(this.handleError('getCoinrankings', [])) return details;
})
); );
} }