I’m learning making an app from a tutorial:
http://meteortips.com/first-meteor-tutorial/databases-part-2/
But there is some thing wrong with it:
It should after clicking a button logging the selected player _id in the console but when I click a li
element it logs the selected player _id.
Do you thing it’s a Incompatibility from previous and new version of meteor or there is something wrong with my code?
javascript:
Template.leaderboard.events({
'click.player': function () {
var playerId = this._id;
Session.set('selectedPlayer', playerId);
},
'click.increment': function () {
var selectedPlayer = Session.get('selectedPlayer');
//PlayersList.update(selectedPlayer, { score: 5 });
console.log(selectedPlayer);
}
});
html:
<head>
<title>Leaderboard</title>
</head>
<body>
<h1>Leaderboard</h1>
{{>leaderboard}}
</body>
<template name="leaderboard">
<ul>
{{#each player}}
<li class="player {{selectedClass}}">{{name}}:{{score}}</li>
{{/each}}
<li><button class="increment">Give 5 Points</button></li>
</ul>
</template>
thanks
Saeed