ko if bug
by bman654
HTML
<button type="button" data-bind="click: cycle">Cycle</button>
<!-- ko if: foo() && !foo2() -->
<div data-bind="text: foo().name"></div>
<!-- /ko -->
JavaScript
var things = [
undefined,
{ name: ko.observable("first") },
{ name: ko.observable("last") }
];
var ithing = ko.observable(1);
var vm = {
foo: ko.computed(function () {
return things[ithing() % things.length];
}),
foo2: ko.observable(false),
cycle: function() { ithing(ithing() + 1); }
};
//vm.cycle();
ko.applyBindings(vm);