如何在 blaze 模板的模板上的另一个函数中创建函数?

How to make the function inside another function on template for blaze template?

我用meteor.js.

我安装了 i18n 和 arillo:flow-router-helpers 包。 我需要这样做:

<a href="{{ pathFor i18n 'dictionary.update' }}">edit</a>

表示 javascript.

中的 pathFor(i18n('dictonary.update'))

如何在 blaze 模板上执行此操作?

您可以在 blaze 中使用括号来组合函数。

你可以做到这一点{{pathFor (i18n 'dictionary.update') }}

圆括号 () 使用参数 dictionary.update 调用函数 i18n。有点像 lisp, the best programming language ever.

这将等同于 pathFor( i18n('dictionary.update') ); 如果函数只是在常规 JS 中。

希望对您有所帮助。