I already subscribe the function to listen the property value change using ko.
var self = this;
$( document ).ready( function () {
var postbox = new ko.subscribable();
var myViewModel =
{
FirstName: ko.observable( "Bert" ),
LastName: ko.observable( "pual" )
};
var sub = null;
for ( var i in myViewModel ) {
var model = myViewModel[i];
model.subscribe( self.notifyChange.bind( model, i ) );
}
$( '#unsubscribeButton' ).click( function () {
// here i want to unsubscribe.
} );
ko.applyBindings( myViewModel );
});
notifyChange = function ( PropName, newValue ) {
var self= this;
);
}
here i want to unsubscribe the notifyChange from myViewModel's property one by one, how to do this?