I need to create an event binding for my observable array in order to trigger a function when the input (e.g., description) changes. I've looked at various solutions online but none of them seem to be working with Typescript. Below is the code I have:
HTML:
<tbody data-bind="foreach: income">
<tr>
<td><input data-bind="value: description, event: {change: save} "/></td>
<td><input data-bind="value: amount"/></td>
</tr>
</tbody>
Typescript:
ko.observableArray.fn['save'] = function () {
// does something
}
income = ko.observableArray([{ description: 'Description', amount: '0'}]);
this.addIncome.save();
The error message states that Property 'saveExtendedBalance' does not exist on type 'KnockoutObservableArray'. How can I rephrase this code?