Using Angular 4, Typescript I am unable to display content of below json:
CV/JOB in a table.
Any hints
{ "took": 56, "timed_out": false, "_shards": { "total": 18, "successful": 18, "failed": 0 }, "hits": { "total": 23381243, "max_score": 2.2639267, "hits": [ { "_index": "2018-09", "_type": "ABC", "_id": "122", "_score": 2.2639267, "fields": { "CV": [ "proc" ], "JOB": [ "pap" ] } }, { "_index": "2018-09", "_type": "ABC", "_id": "123", "_score": 2.2639267, "fields": { "CV": [ "foo" ], "JOB": [ "bnn" ] } } ] } }
You need nested ngFor
in your case,
<tr *ngFor="let dataobj of data.hits.hits">
<td *ngFor="let jobObj of dataobj.fields.JOB">
{{jobObj}}
</td >
<td *ngFor="let hitobj of dataobj.fields.CV">
{{hitobj}}
</td >
</tr>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments