Ad

How To Make The Function Inside Another Function On Template For Blaze Template?

I use meteor.js.

I installed i18n and arillo:flow-router-helpers packages. I need to do like:

<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="{{ pathFor i18n 'dictionary.update' }}">edit</a>

which means pathFor(i18n('dictonary.update')) in javascript.

How to do this on blaze template?

Ad

Answer

You can use parentheses to compose functions in blaze.

you can do this {{pathFor (i18n 'dictionary.update') }}

the parentheses () call the function i18n with the argument dictionary.update. Its kinda like lisp, the best programming language ever.

this would be equivalent to pathFor( i18n('dictionary.update') ); if the functions where just in regular JS.

I hope that helps.

Ad
source: stackoverflow.com
Ad