• function

{{#each key}} can.Mustache.helpers.each


{{#each key}}BLOCK{{/each}}

Render the block of text for each item in key's value.


  1. 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.

  2. BLOCK {can.Mustache}

    A template that is rendered for each item in the key's value. The BLOCK is rendered with the context set to the item being rendered.


Use the each helper to itterate over a array of items and render the block between the helper and the slash. For example,

The template:

  {{#each friends}}

Rendered with:

{friends: [{name: "Austin"},{name: "Justin"}]}