ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 278.2k

How to apply red color font to specific column for dynamic d

May 19 2020 9:48 PM
I work on angular 7 app I need to apply red color font to specific column
but i dont know how to do that ?
I show data dynamically meaning no fixed column or data and code below working without any issue
my main thing i need is if columnname='onlineurl' make font color to red
my code as below datasource on ts as below :
  1. this._displayreport.GetReportDetailsPaging(this.searchData).subscribe((data: any[]) => {  
  2.   
  3. this.reportdetailslist = data;  
  4.   
  5. this.headerCols = Object.keys(data[0]);  
  6.   
  7. data.forEach((item) =>{  
  8. let values = Object.keys(item).map((key)=> item[key]).filter(item =>item != data[0].totalCount)  
  9.   
  10. this.contentBody.push(values);  
  11.   
  12.   
  13. });  
  14.   
  15.   
  16. });  
to get header without data i do as below :
  1. <thead style="width: max-content">  
  2. <tr>  
  3. <th *ngFor="let coln of headerCols">  
  4. <ng-container *ngIf="coln != 'totalCount'">  
  5.   
  6. {{coln}}  
  7. </ng-container>  
  8. </th>  
  9. </tr>  
  10.   
  11.   
  12. </tr>  
  13. </thead>  
to get content data without header i do
  1. <tr *ngFor="let rep of contentBody">  
  2.   
  3. <td *ngFor="let r1 of rep"><span>{{r1}}</span></td>  
  4.   
  5. <td  
  6. </tr>  

Answers (4)