I'm using the knockout-switch-case extension plugin, and I am having a difficult time getting it to work with even the simplest of code. Using knockout 3.0, below is the code I'm using; both the I'm a boolean! and I'm an other text will be shown.
// Javascript
ko.applyBindings({type: 'integer'});
<!-- Html bindings -->
<div>
<!-- ko switch: type -->
<!-- ko case: 'boolean' -->
<span> Im a boolean!</span>
<!-- /ko -->
<!-- ko case: $else -->
<span> Im an other!</span>
<!-- /ko -->
<!-- /ko -->
</div>
Here's a JSFiddle of the code. Am I doing something incorrect in use of this plugin?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…