{{#each key}}
can.Mustache.helpers.each
{{#each key}}BLOCK{{/each}}
Render the block of text for each item in key's value.
Parameters
-
key
{key}A key that references a value within the current or parent context. If the value is a function or can.compute, the function's return value is used.
If the value of the key is a can.Observe.List, the resulting HTML is updated when the list changes. When a change in the list happens, only the minimum amount of DOM element changes occur.
-
BLOCK
{can.Mustache}A template that is rendered for each item in the
key's value. TheBLOCKis rendered with the context set to the item being rendered.
Use
Use the
eachhelper to iterate over a array of items and render the block between the helper and the slash. For example,The template:
Rendered with:
Renders: