最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

mustache - Conditional rendering always shows same message despite variable being 0 or 1 - Stack Overflow

programmeradmin0浏览0评论

I pass a variable with the content 0 or 1 to the template.

I would like something to be output if the value is 0 (false) and something else to be output if the value is 1 (true).

I tried the following:

{{#schuelerdaten}}
  {{#genehmigt}}Ist genehmigt{{/genehmigt}}
  {{^genehmigt}}Ist nicht genehmigt{{/genehmigt}}
{{/schuelerdaten}}

and

{{#schuelerdaten.genehmigt}}
    Ist genehmigt.
{{/schuelerdaten.genehmigt}}

The message "Ist nicht genehmigt" always appears when there is a 1 or a 0 in the database.

发布评论

评论列表(0)

  1. 暂无评论