Skip to content Skip to sidebar Skip to footer

Detect If A Change Occur In Observablearray

Does anyone have idea, if it's possible to detect whenever a change occur inside observableArray while using ko mapping, this mean without having to create the model by hand? self.

Solution 1:

If I'm not mistaken, you should be able to use subscribe on the observable to get that information.

See the bottom of this page for more info:

Explicitly subscribing to observables

Solution 2:

self.items = ko.observableArray([])   
self.item.subscribe(function(context){  
//Comment if there is any changes in the observable array this function will get trigger and changed date ma get in context   

});

Post a Comment for "Detect If A Change Occur In Observablearray"