ahmed elbarbary

ahmed elbarbary

  • 1.1k
  • 892
  • 37.2k

How to display text field as icon based on condition repor ?

May 19 2020 9:32 AM
I working on angular 7 app i need to write condition on data content to display text field as link
 on this line content of data  display 
  1. <ng-container *ngFor="let repdata of ReportData">    
  2.               <tr *ngFor="let rep of contentBody">    
  3.     
  4.                 <td *ngFor="let r1 of rep"><span ngcontent-wdt-c24="" nbtooltipplacement="right"    
  5.                     class="ng-star-inserted">{{r1}}</span></td>    
  6.     
  7.                 <td    
 
 on these line header display meaning columns name
  1. <thead style="width: max-content">    
  2.          <tr>    
  3.            <th _ngcontent-wdt-c24="" style="width: max-content;" *ngFor="let coln of headerCols">    
  4.              <ng-container *ngIf="coln != 'totalCount'">    
  5.   
  6.                {{coln}}    
  7.              </ng-container>    
  8.            </th>    
  9.   
  10.   
  11.          </tr>    
  12.        </thead>   
 ts for content body and headercol data source
  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.      });  
 data displayes is 
  1. reportid  url   
  2. 1222     display as icon  
  3. 1333     as it returned  
  4. 1555    as it returned  
I need to know how to write condition if reportid=1222
 
then display column as icon can click on it
 
on 
 
data above i have two column must be exist
 
reportid  url
 
I need to write if reportid =2020 then convert text url to icon 
 
so how to do that please ? 

Brought to you by: