有可能在把手条件内执行布尔逻辑吗?把手模板内的布尔逻辑
现在我欺骗与控制器功能的这种行为,所以我最终与控制器
App.ApplicationController = Ember.Controller.extend({
bool1: true,
bool2: true,
both: function(){ return this.bool1 && this.bool2; }.property('content.both'),
});
,让我使用的
<script type="text/x-handlebars">
{{#if both}}
<p> both were true </p>
{{/if}}
</script>
一个车把模板和工作正常,但会产生一些问题。首先,它掩盖了发生的事情(特别是如果没有使用好的函数名称)。其次,它似乎侵犯了MVC的分离。
是否可以一起做的
<script type="text/x-handlebars">
{{#if bool1 && bool2}} <!-- this will not actually work -->
<p> both were true </p>
{{/if}}
</script>
线的东西和它的工作?
看到相关:http://stackoverflow.com/questions/14149415/double-condition-with-if – CraigTeegarden 2013-02-12 19:02:19