[Handlebars.js] Register custom helper methods with registerHelper
Handlebars.js can register custom helper methods using registerHelper.
For example, when you want to use the encodeURIComponent method in a template,
Handlebars.registerHelper('encodeURIComponent', encodeURIComponent);
register the helper like this, and
{{encodeURIComponent 'http://tryhandlebarsjs.com/'}}
write it in the template, then
http%3A%2F%2Ftryhandlebarsjs.com%2F
HTML like this will be output.
When the helper is no longer needed,
Handlebars.unregisterHelper('encodeURIComponent');
you can unassign it.
That’s all from the Gemba.