Moe-js v0.3

Capture Blocks

Capture blocks let you redirect the output of a template to a variable.

For example the following causes the content of the capture block to be rendered to a string and stored in the variable userNameParagraph.

{{#capture var userNameParagraph}}

This variable can then be used elsewhere in the template:


Capture blocks can also be used to pass additional content to an outer layout by storing additional content on the model object:

{{#capture model.userScripts}}
   <script src=""></script>

The layout file might then look something like this:

{{#if model.userScripts}}

Subscribe for more like this. No spam, just fun tech stuff :)

Or, find me on Twitter: @toptensoftware.