Issue in Table data in angular.Printing multiple times at each row


This Content is from Stack Overflow. Question asked by KingCk

I’m trying to create a table which i’m trying to feed three data that is itemTitle,itemValue and itemUnit.

This is my model 
export class HubxDataModel{ 
export class HubxModel{ 
    id: number;
    categoryId: number;
    itemTitle: string;
    itemUnit: string;
    isActive: boolean=true;
    itemValue: string;
    patientId: number;
    isDeleted: boolean;

and this is how i declare my model in my component class

hubxReportList : Array<HubxDataModel> = [];

And this is my table header

headers = ["Test Name","Result","Unit"];

and this is the Html that i used to create my table

    <th *ngFor="let column of headers">
 <tr *ngFor="let item of hubxReport.hubxDataItems">
   <td *ngFor="let column of headers">

I’ll share my table image.Here HBA1C is the itemTitle(Test Name), 18 is the itemValue(Result) and mmol is the itemUnit(Unit).All the three data is priting in each column multiple times.How can i fix it.

the code i tried to solve the issue but having issue. At the below line of i’m trying to supply column data


but this code has issue i think i have to specify which column should be used in itemTitle,itemValue and itemUnit.
I need to know the correct way to specify the below code is what i tried to specify the columns data

{{item.itemTitle[column == "TestName"]}}{{item.itemValue[column == "Result" ]}}{{item.itemUnit[column == "Unit"]}}


Check the Answers

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?