Currently, I am utilizing Anular9
and implementing mat-raised-button
in the following manner:
<button mat-raised-button (click)="saveClick()" color="primary"><mat-icon>check</mat-icon> Ok</button>
The function saveClick()
is outlined as follows:
saveClick() {
for (let i = 0; i < this.hostid.length; i++) {
const saudit: SInterface = {
data: this.data,
eid: this.eid[i],
serverId: this.hostid[i]
};
this.subs.sink = this.sservice.addRecord(saudit)
.subscribe(s => {
this.dialog.close();
});
}
}
It's important to note that the data
is shared among all the records.
As of now, the current code only saves the initial record with i=0
.
How can we modify the saveClick()
function to save all records until i < this.hostid.length
?