Exploring Angular and currently using Angular CLI version 8.1.0.
I have two APIs, as shown below:
For bank details:
[
{
"strAccountHolderName": "Sarika Gurav",
"strAccountNumber": "21563245632114531",
"bankName": "IFSC",
"ifsc": "IFSC00014",
"branch": "Tardeo"
}
]
For KYC details
[
{
"strCompanyRegNumber": "123456",
"strGSTNumber": "11242",
"strAadharNumber": "3412345667",
"createdOn": "2020-02-01 09:29:19.723600"
}
]
I have a material table on the first page displaying a list of requests for bank and KYC. When selecting a "bank" row, I want to display the aforementioned information on the next page. While I am able to render the API data on the HTML Page, my goal is to present it in the material table.
In addition, I aim to dynamically change the column names according to the request type.
For bank requests, I intend to display the following information:
Account Holder Name: Sarika Gurav
Account Number: 21563245632114531
Bank Name: IFSC
And for KYC requests:
Company Registration Number: 123456
GST Number: 11242
Aadhar Number: 3412345667
approval.component.html
<h5>Additional Details</h5>
<table mat-table [dataSource]="additionalDetailsDataSource" class="mat-elevation-z1">
<ng-container matColumnDef="item">
<td mat-cell *matCellDef="let services" class="item-name"> {{services.item}} </td>
</ng-container>
<ng-container matColumnDef="value">
<td mat-cell *matCellDef="let services"> {{services.value}} </td>
</ng-container>
<tr mat-row *matRowDef="let row; columns: additionalDetailsDisplayedColumns;"></tr>
</table>
approval.component.ts
this.apiService.getVendorById(col,id,rid)
.subscribe(data=>{
this.result = data[0];
});
The API results are stored in the "result" variable.
To display them on the HTML page, I use: {{result?.strAccountHolderName}}
If there's a way to dynamically modify the column names on the material table, any insights are appreciated!