So in database we have jsonChanges: string[] parameter. Json look like ..
"{"field":"referringPhysician","oldValue":"Medical oncologist","newValue":"Clinical oncologist"}"
in my case I need to show in my angular component table oldValue and newValue. This values inside dropdown after editing user automatically saved to database as old and newValue but inside just one string[] parameter.I need somehow extract this values from this array and show them.
1 -- My table
<table class="listing">
<thead>
<th class="table-column-min">User Name</th>
<th class="table-column-min">Modified Date</th>
<th class="table-column-min">Entity Name</th>
<th class="table-column-min">Old Value</th>
<th class="table-column-min">New Value</th>
</thead>
<tbody>
<tr *ngFor="let at of auditTrailList | paginate: { itemsPerPage: _ITEMS_PER_PAGE, currentPage: crtPage, totalItems: totalItems }"
[attr.data-row-id]="at.userId">
<td>{{ at.userName }}</td>
<td>{{ at.timestamp ? (at.timestamp | date: CUSTOM_DATE_FORMAT ) : 'Unknown' }}</td>
<td>{{ at.entityName }}</td>
<td>TODO: old value</td>
<td>TODO: new value</td>
</tr>
</tbody>
2 -- My Component
getList(patientId?: number, pageNo?: number) {
const auditTrailSubscription =
this._auditTrailService.getAuditTrailUrl(patientId, pageNo,
GridConfig.ITEMS_PER_PAGE)
.subscribe(
result => {
this.getPersonId();
this.auditTrailList = result.lstRecords;
this.totalItems = result.recordsCount;
},
err => {
this.handleError(err);
}
);
this.addSubscription("auditTrail", auditTrailSubscription);
}
entityId: 10027 entityName: "Primary Diagnosis (pr)" id: 10 jsonChanges: "{"field":"referringPhysician","oldValue":"Medical oncologist","newValue":"Clinical oncologist"}" parentEntityId: null parentEntityName: null tenantId: 1 timestamp: 1553696043507 userId: 20020 userName: "Clinician.1"