Helpers

Handlebars templates are strings interpolated by JavaScript functions. When the function comes across double curlies, it tries to resolve the instance of the delimiter with an object property or invoke a nested function to return a string. These nested functions are called helpers and are created in the application. There are a few helpers built into the Handlebars library, and Ember adds some of its own.

Helpers can take two forms. The first are inline helpers, which use the syntax {{[helper name] [arguments]}}. The arguments can include a hash of options, such as:

{{input type="text" value=firstName disabled=entryNotAllowed size="50"}}

More complex helpers use a block syntax:

{{#[helper name] [arguments]}} [block content] ...

Get Front-End Web Development: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.