Subscribe to observable array for new or removed entry only

前端 未结 6 1059
被撕碎了的回忆
被撕碎了的回忆 2020-12-08 12:39

So yes I can subscribe to an observable array:

vm.myArray = ko.observableArray();
vm.myArray.subscribe(function(newVal){...});

The problem

6条回答
  •  轮回少年
    2020-12-08 13:08

    Try vm.myArray().arrayChanged.subscribe(function(eventArgs))

    That has the added value when an item is added, and the removed value when an item is removed.

提交回复
热议问题