In an input form, I am showing a list of textual values in drop down and storing an index value of the user selected item in the back end table.
For example, I have an array like this. In the input form, I am showing the name attribute in the dropdown, but storing value attribute in the table.
NEIGHBOURHOOD_TYPES = [
{value: 1, name: 'School'},
{value: 2, name: 'College'},
{value: 3, name: 'Hospital'}
];
In a display screen of that same data, I am fetching the records from table and i am getting value 1,2,3, etc. I want to show its corresponding name attribute in a simple <td> element.
<table mat-table [dataSource]="dataSource" matSort>
<!-- Type Column -->
<ng-container matColumnDef="type">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Type </th>
<td mat-cell *matCellDef="let row"> {{row.neighbourhoodType}} </td>
</ng-container>
showing 1,2,etc. But I want it to show its corresponding name attribute.
what is the simplest and best option to do it?
Refer the screen shot of the usage screen
(sorry for this naive question, but I am new to angular.).