Divyesh Savaliya
Divyesh Savaliya

Reputation: 2730

Meteor: Session is not defined

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.

Upvotes: 6

Views: 2858

Answers (1)

David Weldon
David Weldon

Reputation: 64312

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

meteor add session

Upvotes: 10

Related Questions