I work on angular 7 app I display data and column headers dynamically
I show content data without header by using content Body Variable
but problem I face is cannot catch data values or catch data cell values so that
I need to add key to content body
my ts code
- this._displayreport.GetReportDetailsPaging(this.searchData).subscribe((data: any[]) => {
- this.reportdetailslist = data;
- this.headerCols = Object.keys(data[0]);
- data.forEach((item) =>{
- let values = Object.keys(item).map((key)=> item[key])
- this.contentBody.push(values);
- });
to get contentbody data I do
- <tr *ngFor="let rep of contentBody">
- <td *ngFor="let r1 of rep"><span>{{r1}}</span></td>
- <td
- </tr>
Result Returned
ReportId onlineurl reportdate
1222 localhost:5000/ 12-12-2018
data current for content body displayed on browser console as :
0:["1222","localhost:5000/","12-12-2018"]
Expected Result i need to content body display as below
0:[{revisionid:"1222",onlineurl:"localhost:5000/",reportdate:"12-12-2018"}]