我在 js 文件中有这个:
isAdmin: function() {
if (Meteor.user().roles[0] == "admin") {
return true;
} else {
return false;
}
},
在Html中我想说if admin ==false.怎么回事?
条件为真:我要假
{{#if isAdmin}}
...
{{/if}}
这样可以吗?
{{#if !isAdmin}}
...
{{/if}}
最佳答案
我猜你在找什么
{{#unless isAdmin}}
...
{{/unless}}
看看here在文档中。
顺便说一句,如果您使用的是 alanning:roles 包,它包含一个方便的 Blaze 小 helper 。
{{#unless isInRole 'admin'}}
...
{{/unless}}
希望对您有所帮助。
关于meteor - if is not equal in blaze 怎么写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43410427/