How to find Array length inside the Handlebar templates?

后端 未结 4 1057
误落风尘
误落风尘 2021-02-01 11:43

I have a Handlebars template which is rendered using a json object. In this json I am sending an array. Like this:

var json = {
               \"array\":[\"abc\"         


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-01 12:29

    If you are testing for an empty list in order to display content... In Ember.js which uses handlebars, you can have an else for the #each.

    {{#each blah as |blah|}}
    
    {{else}}
     //   If array is empty
    {{/each}}
    

提交回复
热议问题