Ya suscribo la función para escuchar el cambio de valor de propiedad usando ko.¿Cómo darse de baja de la función suscrita en knockout?
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;
);
}
aquí Quiero darme de baja del NotifyChange de una propiedad de myViewModel por uno, de cómo hacer esto?