#How to add and delete rows after button click?

6 messages · Page 1 of 1 (latest)

chilly wedge
proven sky
#
<input type="number" [(ngModel)]="day.hoursSpent" />
proven sky
#

You didn't try that. You tried [(ngModel)]="hoursSpent". So yes, this is the same, unique hoursSpent property for every row. That's not what my suggestion does. It stores the hoursSpent in the current day object being displayed in the row.

#

You're trying to store the hours inside activity, whic is an array. You must store it inside item, the element of this array. Also, define types and respect them. Don't initialize hours with an empty string since it's supposed to be a number.

#

No. Please read #how-to-get-help . Post code as text. Post a minimal reproduction in a stackblitz.

#

This error message says what the problem is: you're trying to read a property named hours on some variable, at line 4, column 5 of table-entries.component.html. And this variable contains the value undefined.