Similar to the toggle
handler, but it will detach the element from the DOM instead of just hiding it. Much like knockout's if
binding.
Usage
<div data-bind="if: someCondition"></div>
where someCondition
can of course also be a computed property, so this gives you all flexibility you need.
Why not use just toggle
? Because selectors like :first
etc. won't work.
When in doubt, make it async. Epoxy bindings allow you to define an
init
method (see https://github.com/gmac/backbone.epoxy/blob/master/backbone.epoxy.js#L613-L618), within which you should be able to define asetTimeout(..., 0)
to schedule an initial rendering on the next event loop.