Template Tags
Template tags can used within jQuery templates in addition to text and HTML markup, in order to enable a number of scenarios such as composition of templates, iteration over hierarchical data, parameterization of template rendering, etc.
Available tags include: ${}, {{each}}, {{if}}, {{else}}, {{html}}, {tmpl}} and {{wrap}}.
-
{{each}} Template Tag
Used to iterate over a data array, and render the content between the opening and closing template tags once for each data item.
-
{{else}} Template Tag
Used in association with the {{if}}...{{/if}} tag to provide alternative content based on the values of one or more expressions. The {{else}} tag can be used without a parameter, as in: {{if a}}...{{else}}...{{/if}}, or with a parameter, as in: {{if a}}...{{else b}}...{{/if}}.
-
${} Template Tag
Used for insertion of data values in the rendered template. Evaluates the specified field (property) on the current data item, or the specified JavaScript function or expression.
-
{{html}} Template Tag
Used for insertion of HTML markup strings in the rendered template. Evaluates the specified field on the current data item, or the specified JavaScript function or expression.
-
{{if}} Template Tag
Used for conditional insertion of content. Renders the content between the opening and closing template tags only if the specified data item field, JavaScript function or expression does not evaluate to false (or to zero, null, type "undefined", or the empty string ).
-
{{tmpl}} Template Tag
Used for composition of templates. Renders one or more nested template items within the rendered output of the parent template.
-
{{wrap}} Template Tag
Used for composition of templates which incorporate wrapped HTML content. Rendered template items can combine wrapped HTML content with template markup.