{{#case(expression)}}
{{#case(EXPRESSION)}}BLOCK{{/case}}
Renders the BLOCK when EXPRESSION matches the EXPRESSION provided in the parent {{#switch(expression)}}.
{{#switch(user.type)}}
{{#case("admin")}}
<button value="edit"/>
{{/case}}
{{#case("manager")}}
<button value="view">
{{/case}}
{{#default()}}
You do not have permission!
{{/default}}
{{/switch}}
Parameters
- EXPRESSION
{Literal Expression|KeyLookup Expression|Call Expression}:An expression or key that references a value.
- BLOCK
{sectionRenderer(context, helpers)}:A subsection that will be rendered if the case
EXPRESSIONmatches the switch’sEXPRESSION.
Use
The case helper is contextual inside of a {{#switch(expression)}} block. The parent switch contains an expr that will be matched against the case expr and if they are equal the block will be returned.
For more information on how {{#case()}} is used check: