{{#switch expr}}
can.stache.helpers.switch
{{#switch expr}}BLOCK{{/switch}}
Renders the BLOCK
with contextual {{#case expr}} and {{#default}} helpers.
Parameters
-
expr
{can.stache.expression}
An expression or key that references a value that will be switched on.
-
BLOCK
{can.stache(template)}
a template that is rendered, uses {{#case expr}} and {{#default}} helpers to match
expr
.
Returns
{DocumentFragment}
A fragment containing the rendered BLOCK
.
The
switch
helper is used to render a block where one of several cases matches expr. It works just like a JavaScript switch.