我有 2 个共享视图的视图,我试图在它们之间传递变量以打开|关闭各种 html 段。这可能吗?当我运行 console.log 时,view.showTitle variable = "view.showTitle"
不是应该是 1 吗?奇怪,对吧?
视图 1 调用视图 2 并传递参数:
{{view "components/social" showTitle="1"}}
视图 2 尝试将此参数传递给辅助函数:
{{#variable-exists view.showTitle}}
YES
{{else}}
NO
{{/variable-exists}}
被调用的助手:
export default function(elem,options) {
if (Ember.isEmpty(elem)) {
return options.inverse(this);
} else {
return options.fn(this);
}
}
我正在使用ember cli项目来构建我的 ember 应用程序。
发这篇文章时的当前设置:
DEBUG: -------------------------------
DEBUG: Ember : 1.5.1
DEBUG: Ember Data : 1.0.0-beta.7+canary.b45e23ba
DEBUG: Handlebars : 1.3.0
DEBUG: jQuery : 2.1.1
DEBUG: -------------------------------