Closed PierBover closed 8 years ago
no, there isn't, I guess because the resulting syntax would be not so intuitive. An hypothetical rt-else
would have to refer to its upper sibiling node, which is unusual in HTML.
When I have to write "else branches", I just use an if-not:
<dif rt-if="cond()">then branch</div>
<dif rt-if="!cond()">else branch</div>
if you are concerned about the condition being evaluated twice (in case it's slow etc):
<virtual rt-scope="cond() as c">
<dif rt-if="c">then branch</div>
<dif rt-if="!c">else branch</div>
</virtual>
Thanks for the answer @nippur72
When I have to write "else branches", I just use an if-not
Yes, that's what I ended up doing. It's not so bad for simple stuff.
Using
rt-if
we can render elements based on a condition.Is there anything like
rt-else
to render something else if the condition is not met?