admin管理员组

文章数量:1317906

I am learning meteor and following this link.

When I use Session.set it gives me error Session is not defined in console

My code of main.js file within client folder is following

PlayersList = new Meteor.Collection('players'); 

 if(Meteor.isClient) {
     Template.leaderboard.events({
        'click .playerName  ': function(){
            var playerId = this._id;
            Session.set('selectedPlayer', playerId);
        }
     });
 }

I don't know what I am doing wrong

I already read this post.

My file is inside client folder and code also inside isClient condition. Still it giving me error.

I am learning meteor and following this link.

When I use Session.set it gives me error Session is not defined in console

My code of main.js file within client folder is following

PlayersList = new Meteor.Collection('players'); 

 if(Meteor.isClient) {
     Template.leaderboard.events({
        'click .playerName  ': function(){
            var playerId = this._id;
            Session.set('selectedPlayer', playerId);
        }
     });
 }

I don't know what I am doing wrong

I already read this post.

My file is inside client folder and code also inside isClient condition. Still it giving me error.

Share Improve this question edited Oct 30, 2017 at 4:25 Divyesh Savaliya asked Apr 1, 2016 at 12:00 Divyesh SavaliyaDivyesh Savaliya 2,7402 gold badges20 silver badges38 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

The session package isn't installed by default anymore. You just need to run:

meteor add session

本文标签: javascriptMeteor Session is not definedStack Overflow