javascript - HandlebarsJS pass helper to another helper -
i have 2 helpers, 1 called tablerows , called svg-icon. want pass result of svg-icon tablerows. svg-icon returns handlebars.safestring of html. how can achieve this? saw called subexpression can't seem work.
{{#tablerows section="highlights" }}{{/tablerows}} {{#svg-icon symbol=symbol.value size="small" class="svg-icon--table" }}{{/svg-icon}} this i'm trying achieve no success:
{{#tablerows section="highlights" {{#svg-icon symbol=symbol.value size="small" class="svg-icon--table" }}{{/svg-icon}} }} {{/tablerows}}
you invoking helpers if block helpers, using # symbol, there no need them block helpers there nothing between opening , closing tags.
if instead use these helpers regular, non-block, helpers, able make use of subexpressions in order pass result of svg-icon helper tablerows helper:
{{tablerows (svg-icon symbol=symbol.value size="small" class="svg-icon--table") section="highlights"}} note: assumes tablerows helper has been defined accept html string, returned svg-icon, first parameter:
handlebars.registerhelper('tablerows', function (iconhtml, options) { /* helper body goes here. */ });
Comments
Post a Comment