【发布时间】:2015-02-04 15:02:29
【问题描述】:
我正在尝试使用流星创建一个显示最新强力球结果的页面。
到目前为止,我有一个使用的工作页面:
RESULTS.JS
Template.results.helpers({
results: function () {
return Session.get('lottery-results');
},
winning: function() {
return Session.get('winning')
}
});
Template.results.rendered = function(){
Session.set('lottery-results', []);
HTTP.get("http://data.ny.gov/resource/d6yy-54nr.json", function (err, result) {
Session.set('lottery-results', JSON.parse(result.content) );
});
};
Template.results.events({
'change #date': function (e, tmpl) {
Session.set('winning', $('#date option:selected').data('winning'))
}
});
Template.results.destroyed = function(){
Session.set('winning', []);
};
和
结果.HTML
<template name="results">
<select id="date">
<option>Select a date</option>
{{#each results}}
<option data-winning="{{ winning_numbers }}">{{dateFormat draw_date format="MM/DD/YYYY"}}</option>
{{/each}}
</select>
<h1>{{ winning }}</h1>
</template>
我想设置结果的样式,以便数字出现在球内。前 5 个数字将是一种风格(白球),最后一个数字
【问题讨论】:
标签: javascript css json meteor