【问题标题】:How to make the function inside another function on template for blaze template?如何在 blaze 模板的模板上的另一个函数中创建函数?
【发布时间】:2016-04-28 11:57:03
【问题描述】:

我使用meteor.js。

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

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

在 javascript 中表示 pathFor(i18n('ditonary.update'))。

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

【问题讨论】:

    标签: javascript html templates meteor meteor-blaze


    【解决方案1】:

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

    你可以这样做{{pathFor (i18n 'dictionary.update') }}

    括号() 调用带有参数dictionary.update 的函数i18n。有点像lispthe best programming language ever

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

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-26
      • 1970-01-01
      • 2011-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多