Is there any way to specify an enable condition for the click binding? For example if I have the following:
Clic
Kyle, after reading your comment to nemsev, I believe you want to disable your button, not your dialog function.
The binding...
Click me for another call to trigger the dialog
And the code...
var viewModel = function(){
var self = this;
self.allowAlert = ko.observable(true);
self.allowButtonText = ko.computed(function(){
if(self.allowAlert()){
return 'Turn off button';
} else {
return 'Turn on button';
}
});
self.toggleAllowAlert = function(){
self.allowAlert(!self.allowAlert());
};
self.doAlert = function(){
alert('The dialog has opened');
};
}
ko.applyBindings(new viewModel());
http://jsfiddle.net/DQg5P/1/