ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 254.1k

How to make field passed to function goToLink dynamically ch

May 26 2020 1:44 AM
I work on angular 7 app I face Issue I can't pass field name dynamically from repcon.fieldname to goToLink .
 
rep.offlineURL is static field so i need replace offlineURL with repcon.fieldname that return offlineURL
 
on function goToLink I need to replace goToLink(rep.offlineURL) with goToLink(rep.(repcon.fieldname))
 
ReportControl return the following :
  1. [{"reportid":"5","fieldname":"offlineURL","columnType":"1"},{"reportid":"5","fieldname":"onlineURL","columnType":"2"}]   
 
 
component.html
  1. <ng-container *ngFor="let repcon of ReportControl">  
  2.                            
  3.                        <div *ngIf="coln==repcon.fieldName">  
  4.                            
  5.                          
  6.                          <div *ngIf="repcon.columnType==1">  
  7.                              
  8.                            <a (click)="goToLink(rep.offilneURL)"><i nbTooltip="DownloadData" nbTooltipPlacement="bottom" nbTooltipStatus="primary"><nb-icon icon="cloud-download-outline"></nb-icon> </i></a>  
  9.                              
  10.                         </div>  
  11.                        </div>  
  12.                      </ng-container>  
 on component.ts  
  1. goToLink(url: string){    
  2. window.open(url, "_blank");    
  3. }    
  4. I Expected :    
  5.     
  6. goToLink(rep.(repcon.fieldname))    
 

Answers (1)