Search code examples
meteorunderscore.jsmeteor-blaze

usage of underscore js in html meteor blaze project


what is the difference between.

      <span class="icon-plus"></span>
        {{_ "New List"}}
      </a>

and

      <span class="icon-plus"></span>
        New List 
      </a>

I know usage of _ in js files but here _ is in html by the way both of them seem like working identical


Solution

  • {{_ ...}} calls the helper named _. As Denis stated if you've done meteor add tap:i18n then it would call the helper from the tap:i18n package.

    You could also register a helper yourself. I've done this to give myself underscore access in templates:

    Template.registerHelper('_', (method, arr) => _[method](arr));