nanohtml
nanohtml copied to clipboard
Conditional resolution
Is there any solution of implying if..else
logic with templates?
As (as far as I know) we can't put if
statement directly in body of ${ }
, there is probably a need for dedicated if
function e.g. bel.if(condition, onTrue, onFalse)
.
Is something as that envisioned, or maybe already there's some solution (or convention) coined for that?
Unfortunately wiki is very silent on that very common use case.
You can interpolate whatever you like inside bel elements - take a look at the choo examples to see some of this in action: https://github.com/yoshuawuyts/choo/tree/master/examples
On Wed, Dec 7, 2016 at 9:56 AM Mariusz Nowak [email protected] wrote:
Is there any solution of implying if..else logic with templates?
As (as far as I know) we can't put if statement directly in body of ${ }, there is probably a need for dedicated if function e.g. bel.if(condition, onTrue, onFalse).
Is something as that envisioned, or maybe already there's some solution (or convention) coined for that?
Unfortunately wiki https://github.com/shama/bel/wiki is very silent on that very common use case.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/shama/bel/issues/59, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWletAEI3G6Ed5jgRPz9Br7Rf_DFz8Qks5rFnTTgaJpZM4LGV2h .