I am loading an array from a json file. every 1.5 seconds I check if there are any changes in the file (at the moment I am testing one file without any changes), but when I check,
if ( this.itemsParentArray[i] !== this.itemInArray[i] )
it always shows that it is not equal, and console.log ("not equal")
Am I missing something in the code? Here he is:
export class HomeComponent { itemsParentArray = []; itemInArray = []; myRes: Content; showAssigned:boolean = false; constructor(private structureRequest: StructureRequestService) { setInterval(() => { this.timerGetStructure(); }, 1500); }
As you can see, it loads data from one file (I do not change the file data !!!):
this.itemsParentArray = this.myRes.content;
and (every 1.5 seconds):
this.itemInArray = this.myRes.content;
source share