Hi Sander,
Here is the steps about what i am trying to do -
My requirement in brief -
If a particular timestamp property of a JSON array object is different from the current timestamp by 15 minutes or less, i need to highlight/continuously blink the corresponding table(which loads the JSON array object) row on the Template UI.
1. I check for a datetime field within a JSON object and subtract it with current datetime by converting both(former and latter) into milliseconds in my component.
// Check for actively running venues
this.filteredVenues.forEach((ven, index) => {
if (tm.getTime() - (new Date(ven.lastheartbeat).getTime()) <= 900000) {
this.venuesRunning.push(index);
}
console.log(this.venuesRunning);
});
2. If the difference is lesser than 900000 milliseconds, i capture the index of the json sub object and push the same into a component array field
venuesRunning: any = []; // running state of venue
3. On the UI template i have a table which will parse my JSON object and load all its content. However, if any of the row index of the table, matches with the contents/indexes of component array, i need to highlight/blink only those particular rows.
<tr *ngFor="let v of mf.data; index as i" [class.bg-primary]="venuesRunning.includes(v)">
<td>{{i}} {{v.name}}</td>
<td>{{v.address}}</td>
<td>{{v.description}}</td>
.....
The solution you provided seems to be not working for my requirement. It was my bad that i did not put things properly before. Please let me know if that made sense or i need to explain more better.
Thanks,
Rohit