【发布时间】:2016-04-21 14:12:37
【问题描述】:
在我的流星应用程序中,我想有选择地访问页面中的值。
if (Meteor.isClient) {
var percentageData = [
{
percent_type : 'online',
percentage: '20'
},
{
percent_type : 'offline',
percentage: '55'
}
];
Template.authenticated_user.helpers({
percentInformation: percentageData
})
}
在这里,我将一个简单的 JSON 返回到我的模板。
<template name="authenticated_user">
</template>
我想要的是能够将这个 JSON 的页面部分放在不同的地方。
例如:
<div id = {{percentInformation[0].percent_type}}></div> 将 id 分配给“在线”。
这可能吗?
【问题讨论】:
标签: javascript json meteor