ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 275.4k

how to compre between two object vertically

May 1 2020 5:15 PM
I work on angular 7 I have array of two object json inside app.component.ts
 
I need to compare between two object but i need to display compare vertically .
 
this link have json array and sample
 
code I try as below : 
 
  1. import { Component, OnInit } from '@angular/core';  
  2.   
  3. @Component({  
  4.   selector: 'my-app',  
  5.   templateUrl: './app.component.html',  
  6.   styleUrls: ['./app.component.css']  
  7. })  
  8. export class AppComponent implements OnInit {  
  9.   private ldapcaches = [  
  10.     { "id": 1, "host""localhost""filesize": 73, "fileage""2018-01-26 09:26:40" },  
  11.     { "id": 2, "host""localhost""filesize": 21, "fileage""2018-01-26 09:26:32" },  
  12.   ];  
  13.   private originalCache = null;  
  14.   constructor() {  
  15.   }  
  16.   ngOnInit() {  
  17.     for(let cache of this.ldapcaches) {  
  18.       
  19.     }  
  20.     console.log(this.originalCache);  
  21.   }  
  22. }  
 
compare  firstitem                            seconditem
host          localhost                           localhost
filesize        73                                    21
fileage        2018-01-26 09:26:40      2018-01-26 09:26:32
 
so I need
How to display  expected result vertically with colorized difference with red as above ?
what i write on app.component.html
and what i write on ng oninit ? 
 
 

Answers (3)