I´m trying to parse a JSON Object, which I get from an API. Unfortunately I cannot bind the data. I get no error, but no data appear. The alert shows a successful request to the api. (ionic3, Angular 6.0.0)
home.html
exported class: diagnoses : any;
<ion-item *ngFor="let diagnose of diagnoses">
<p>Diagnose: {{diagnose.additionalParameters.dictCanon}}</p>
<p>ID: {{diagnose.additionalParameters.uniqueId}}</p>
</ion-item>
home.ts
startPipeline() {
var text = 'Appendizitis';
this.restProvider.getDiagnoses(text)
.subscribe(
function(response) {
//alert("Success Response" + response);
this.diagnoses = JSON.stringify(response.annotationDtos);
alert(this.diagnoses);
},
function(error) {
alert("Error happened" + error)
},
function() {
//alert("the subscription is completed")
}
);
}
rest.ts
getDiagnoses(text): Observable<any> {
return this.http.post(this.apiUrl, text, httpOptions);
}
}
答案 0 :(得分:0)
just: this.diagnoses = response.annotationDtos