I already subscribe the function to listen the property value change using ko.
var self = this;
$( document ).ready( function () {
var postbox = new ko.subscrib
Store results of call to subscriptions in a variable (or, in your case, in an array).
When you want to unsubscribe, simply call dispose on each subscription.
Fully described here - http://knockoutjs.com/documentation/observables.html
Your code will look like this:
//store subscriptions in array
var subscriptions = [];
for ( var i in myViewModel ) {
var model = myViewModel[i];
subscriptions.push(model.subscribe( self.notifyChange.bind( model, i ) ));
}
//unsubscribe
for(var i in subscriptions) {
subscriptions[i].dispose(); //no longer want notifications
}