JSFiddle: http://jsfiddle.net/PTSkR/177/
Desired behavior: When I click close or the x button, the modal closes, but I can still open it again if I click "show".
What's happening: The modal closes one time and then never opens again.
Code:
ko.bindingHandlers.showModal = {
init: function (element, valueAccessor) {
},
update: function (element, valueAccessor) {
var value = valueAccessor();
if (ko.utils.unwrapObservable(value)) {
$(element).modal('show');
// this is to focus input field inside dialog
$("input", element).focus();
}
else {
$(element).modal('hide');
}
}
};