{{key}}
can.stache.tags.escaped
Insert the value of the key into the output of the template.
{{key}}
Parameters
-
key
{key}
A key that references one of the following:
- A registered helper.
- 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 | function() | *}
After the key's value is found (and set to any function's return value),
it is passed to can.view.txt as the result of a call to its func
argument. There, if the value is a:
null
orundefined
- an empty string is inserted into the rendered template result.String
orNumber
- the value is inserted into the rendered template result.Function
- A hookup attribute or element is inserted so this function will be called back with the DOM element after it is created.
Use
{{key}}
insert data into the template. It most commonly references values within the current [can.stache.context context]. For example:Rendering:
With:
Results in:
If the key value is a String or Number, it is inserted into the template. If it is
null
orundefined
, nothing is added to the template.Nested Properties
Stache supports nested paths, making it possible to look up properties nested deep inside the current context. For example:
Rendering:
With:
Results in:
Looking up values in parent contexts
Sections and block helpers can create their own contexts. If a key's value is not found in the current context, it will look up the key's value in parent contexts. For example:
Rendering:
With:
Results in: