I have an array of objects that are within my <mat-table>
the sync property is a <mat-checkbox>
. I am trying to make it so that when a box is checked and then I press the "sync" button, it will update the lastSynced property with the current date and time within the table.
export interface ConnectionData {
name: string;
active: boolean;
connections: string;
location: string;
users: string;
sync: boolean;
lastSynced: Date | null;
}
const CONNECTIONS: ConnectionData[] = [
{name: '', active: false, connections: '', location: '', users: '', sync: false, lastSynced: },
{name: '', active: false, connections: '', location: '', users: '', sync: false, lastSynced: },{name: '', active: false, connections: '', location: '', users: '', sync: false, lastSynced: },
];
Have the method that's called on the sync buttons (click) that updates the table data. Something like:
for( const connection of connectionData ) {
if(connection.sync) {
connection.lastSynced = new Date(); // update to current date
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.