-
Notifications
You must be signed in to change notification settings - Fork 3
Helpers
Jesper Lindström edited this page Jun 8, 2014
·
1 revision
Helpers are located in app/helpers/*.js
and are merely simple functions that do basic things such as formatting data. In our example application, app.helpers.timeAgo(timestamp)
is a helper that converts a date string into relative time (like "5h ago").
app.helpers.myHelper = function(text) {
// Do something with text
return text;
};
Helpers may also register themselves as Handlebars helpers, accessed via {{myHelper 'Example text'}}
in Handlebars templates.
Handlebars.registerHelper('myHelper', app.helpers.myHelper);