Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to nest helpers inside the options hash with handlebars?

For instance, is there a way to nest my "i18n" helper inside another helper's hash variable?

{{view "SearchView" placeholder="{{t 'search.root'}}" ref="search" url="/pages/search" className='home-search'  polyfill=true}} 
like image 945
mateusmaso Avatar asked Feb 08 '13 21:02

mateusmaso


People also ask

Is there else if in Handlebars?

Handlebars supports {{else if}} blocks as of 3.0. 0.

How do I register Handlebars in Helper?

Handlebars. registerHelper("noop", function(options) { return options. fn(this); }); Handlebars always invokes helpers with the current context as this , so you can invoke the block with this to evaluate the block in the current context.

How do you escape Handlebars?

Escaping Handlebars expressions Handlebars content may be escaped in one of two ways, inline escapes or raw block helpers. Inline escapes created by prefixing a mustache block with \ .


1 Answers

Update: Handlebars now supports subexpressions, so you can just do:

{{view "SearchView" (t 'search.root')}} 
like image 53
Kevin Borders Avatar answered Sep 22 '22 01:09

Kevin Borders