{{^key}}
can.stache.tags.inverse
{{^key}}BLOCK{{/key}}
Render blocks of text if the value of the key is falsey. An inverted section syntax is similar to regular sections except it begins with a caret rather than a pound. If the value referenced is falsey, the section will render.
Parameters
-
key
{key}
A key that references a value within the current or parent [can.stache.context context]. If the value is a function or can.compute, the function's return value is used.
Returns
{String}
Depending on the value's type, the following actions happen:
- A
truthy
value - the block is not rendered. - A
falsey
value - the block is rendered.
The rendered result of the block or an empty string is returned.
Use
Inverted sections match falsey values. An inverted section syntax is similar to regular sections except it begins with a caret rather than a pound. If the value referenced is falsey, the section will render. For example:
The template:
And data:
Results in: