3 ms·
Conceptually its the same as a ternary statement with the addition that the output is looped over if the expression evaluates to an array. Conditional markup i
by dugmartin 17y ago
Conceptually its the same as a ternary statement with the addition that the output is looped over if the expression evaluates to an array.
Conditional markup is necessary somewhere in the system - this puts it in the templates in more compact form that won't break like the multi-line block in the example.
If you put the markup in the controller then you blur the line in the MVC architecture.
- shaunxcode 17y agoOk, the syntax does not exactly lend itself to clarity. If you're going to be parsing why not add key:value pairs so you don't have to use the back tick? Something like: {@ users ? before: "<div id='users'>Users<ol>" each: "<li>{fullname}</li>" after: "</ol></div>" else: "No users found" @}