I have a table with objects. Each object has an associated hour and minute (at its last modification).
Illustrative something like this:
I would like it if it is the same time. A color is applied to the entire row (for 5 seconds).
I was trying some things to try to add and remove classes after 5 seconds with Javascript.
At the moment I have this:
<tr #row *ngFor="let order of orders; index as i" (onload)="getIsNew(order,row)" [ngClass]="{...}">
My idea was that when loading I add the class 'is-new'
to the #row
and after 5 seconds remove it.
The problem is that it does not directly enter the function getIsNew()
.
You are probably doing something wrong with the (onload) event from Angular.
The second option was to use [ngClass]. So it was like this:
<tr #row *ngFor="let order of orders; index as i" [ngClass]="{'is-new': getIsNew(order,row)}">
wheregetIsNew() es esta función:
getIsNew(order: Order, row:any):boolean{
return order.dataOfcreation.hour == this.date.getHour();
}
the problem is that the class stays for 1 whole minute (the hour comparison is HH:MM). I would not like to add seconds to these hours.