怎么不是帮手?

won*_*ton 2 javascript meteor meteor-blaze

执行NOT操作的最佳方法是什么?

例如,这是javascript

Template.mytemplate.helper({
  myhelper : function(){
    return true;
  }
});
Run Code Online (Sandbox Code Playgroud)

现在,我将如何获得!myhelper在模板中?我一直在做

<template name="mytemplate">
  {{#if myhelper}}
  {{else}}
    myhelper is false
  {{/if}}
</template>
Run Code Online (Sandbox Code Playgroud)

但是必须有一个更好的方法.我可以创建一个平等帮助器,{{#if equal myhelper true}}但这似乎不是很干净.

有没有人有更好的想法?

Ted*_*opp 6

我认为你应该能够使用#unless空格键来获得你想要的东西:

<template name="mytemplate">
  {{#unless myhelper}}
    myhelper is false
  {{/unless}}
</template>
Run Code Online (Sandbox Code Playgroud)