I`m use some custom pipe
@Pipe({name: 'keys'}) class KeyPipe implements PipeTransform {
transform(value, args:string[]) : any {
let keys = [];
console.log(value);
for (let key in value) {
keys.push(key);
}
console.log(keys);
return keys;
}
}
for parse object json file
"system":
{
"memory":
{
"total":12425734566,
"used":4725959680,
"free":8947874816,
"actualfree":4221499392,
"actualused":452335104,
"swaptotal":4296819712,
"swapused":0,
"swapfree":4296819712
},
"uptime":" 12 days, 4:09",
"loadaverage":"0.00 0.00 0.00",
"cpu":
{
"vendor":"GenuineIntel",
"family":"6",
"model":"Intel(R) Xeon(R) CPU E5620 @ 2.40GHz",
"rate":"2399.971",
"numofcores":4
}
How to add *ngFor for this table and show the "memory" objects, and how to syntax right?
<table>
<thead>
<tr>
<th>Общая память</th>
<th>Общая используемая память</th>
<th>Свободная память</th>
<th>Используемая память размера подкачки</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let service_rec of list.system.memory | keys">
<td>{{ service_rec.total | keys}}</td>
<td>{{ service_rec.used | keys}}</td>
<td>{{ service_rec.free | keys}}</td>
<td>{{ service_rec.actualfree | keys}}</td>
</tr>
</tbody>
</table>
That code doesnt show the data of "memory". How i can solve this problem?