相关疑难解决方法(0)

Meteor Handlebars:如何访问普通阵列?

var plain_array = [1, 2, 3, 4, 5, 6, 7]

如何显示Meteor Handlebars中的所有元素?

{{#each plain_array}}

# What to put here to get the elements?

{{/each}}
Run Code Online (Sandbox Code Playgroud)

(这个问题类似:把手:如何访问数组?但是与其他问题不一样,假定一个对象数组.)

javascript handlebars.js meteor

23
推荐指数
1
解决办法
7873
查看次数

如何在Meteor JS中将数组值加载到模板变量?

如何在Meteor中将数组值加载到模板变量?请看下面的代码并建议我该怎么做?

HTML代码:

 <template name="header">
 <div class="header">
    {{#each alphabets}}
       <div class="alphabets">{{this}}</div>
    {{/each}}
 </div>
</template>
Run Code Online (Sandbox Code Playgroud)

JS代码:

 //the below array values are load dynamically above template
 var Alphas = ['ALL',
              'A', 'B', 'C', 'D','E', 'F',
              'G', 'H', 'I', 'J','K', 'L',
              'M', 'N', 'O', 'P','Q', 'R',
              'S', 'T', 'U', 'V','W', 'X',
              'Y', 'Z'
              ]

        Template.header.alphabets = function (i)
         {
           return Alphas[i];
         };
Run Code Online (Sandbox Code Playgroud)

javascript meteor

2
推荐指数
1
解决办法
7541
查看次数

标签 统计

javascript ×2

meteor ×2

handlebars.js ×1