Unable to parse bindings. knockout error

前端 未结 1 1821
执笔经年
执笔经年 2021-01-21 19:48

this is my day 2 learning Knockout.

Trying to attach \"deleteItem\" for button click. it gives the following error.

Error

Uncaught Err

相关标签:
1条回答
  • 2021-01-21 20:20

    The function deleteItem is on your view model. When you're binding inside the foreach, the context of the binding operation is the individual item from the listItem array. You need to bind to $root.deleteItem to reference the root view model.

    0 讨论(0)
提交回复
热议问题