Receiving data from the backend in a straightforward manner:
this.archiveService.getRooms(team).subscribe(
res => {
this.form = res;
this.form.forEach(el => {
el.reservation.slice(-6).match(/.{1,2}/g).join('/');
});
},
error => {
console.log(error);
}
)
this.form
represents an object where I extract reservation numbers and remove unnecessary parts using regular expressions. After preparing the value, it is assigned back to this.form
for displaying with *ngFor in a table.
The challenge lies in assigning each value from the forEach loop back into this.form
.