将空格参数传递给另一个空格参数
Pass spacebar parameter to another spacebar parameter
我试图在meteor.js中从一个模板传递参数到另一个模板我想干这个缘故第一个模板看起来像这样
template(name="myPage")
h3.uppercase.amarillo-hogar
+editaMl(data=this collection="categorias" field="titulo")
template(name="editaMl")
if i18n_isCurrentLanguage 'es'
| {{collection}} {{field}}
+editableText(context=data collection=collection field=field userCanEdit=userCanEdit acceptEmpty=true substitute='<i class="fa fa-pencil"></i>')
else
+editableText(collection=collection field=field userCanEdit=userCanEdit acceptEmpty=true substitute='<i class="fa fa-pencil"></i>')
这样我就不用在每个翻译字段重复自己了但是不能将参数值传递给另一个模板参数值
我用翡翠,现在在HTML中为那些不喜欢翡翠的人
<template name="myPage">
<h3 class="uppercase amarillo-hogar>{{> editaMl collection="categorias" field="titulo"}}</h3>
</template
<template name="editaMl">
{{#if i18n_isCurrentLanguage 'es'}}
{{> editableText collection=collection field=field }}
{{/if}}
{{#else}}
{{> editableText collection=collection field=field }}
{{/else}}
</template>
只是如果你想知道,我使用babraham可编辑文本包和tap_i18n tap_i18n UI来翻译
找不到我的助手返回对象的原因,当在内容{{collection}}中这样使用时,但当在子模板中用作参数时,什么也不做
Code updated and SOLVED
您可以使用:
Template.registerHelper('yourHelperName', function() {
// your helper
});
创建一个在所有模板中可用的帮助器
相关文章:
- 函数参数中的数据与指定变量之间的任何性能差异
- 使用Express捕获参数
- 参数变量出现ngTable指令问题
- AngularJS:我可以跳过函数参数回调吗
- 如何使用skip参数使用angular ui引导进行服务器端分页
- 我如何找到一个句子中的所有空格并替换忽略它们
- 要求未定义JS回调参数
- 我的jQuery插件参数没有正确启动,遇到了问题
- javascript / jQuery “insertAfter” 函数参数中的空格会导致失败
- 如何在 PHP 的 OnClick 函数中将带有空格的变量作为参数传递
- 更改Netbeans为javascript函数参数自动设置空格缩进格式的方式
- 如果在调用函数时提供的参数包含空格,则不调用函数
- 提取url参数后删除空格
- 将空格参数传递给另一个空格参数
- 空格-在纯javascript中插入参数,不带手柄样式的大括号
- 带空格的AngularJS自定义指令参数
- 流星-模板助手参数(空格)
- 如何将查询参数作为字符串传递到包含空格的jquery负载中
- 将参数作为字符串传递,在javascript的onclick函数中包含空格
- 将带有空格字符的字符串作为参数传递给javascript生成的点击函数