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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.