I work on angular 7 app I face issue : I can't make column Name company Name hide data
where field Name of report Control json is Company Name .
report control is table have field Name.
Based on Field Name value I will hide data on column Assigned to Field Name .
<ng-container *ngFor="let repcon of ReportControl">
<div *ngIf="coln==repcon.fieldName">
</div>
</ng-container>
stack blitz I work on it as below and it have all data related and code :
https://stackblitz.com/edit/create-z4aduq?file=app/app.component.html
On component.ts
repcon return data for report control as below :
report control is :
[{"reportId":2028,"fieldName":"companyName","columnType":1}]
Expected result as you see below company name is empty :
can there are any way can do that by dynamic way I use field Name to can use it control based on field name exist then i can use it .
why not like below :
*ngIf="coln==repcon.fieldName
if i understand your question the solution:
if you just hide companyName column values use below:
<span *ngIf="coln != 'companyName'" >
{{rep[coln]}}
</span>
if you only change header 'companyName' to 'fieldName' you just change
<div>{{coln}}</div>
to
<div>{{coln == "companyName" ? "fieldName" : coln}}</div>