Get And set session value which is globally accessed across all the templates in meteor using angular js

I’m using meteor along with angular js. I have used ui-router package to route through different templates. Templates here means different HTML pages. Have a look at my example

angular.module(‘MyApp’).directive(‘login’, function () {
return {
restrict: ‘E’,
templateUrl: ‘login.html’,
controllerAs: ‘login’,
controller: function ($scope, $reactive, $meteor, $stateParams) {
// All Logic for login page goes here
}
}
}
});

angular.module(‘MyApp’).directive(‘Home’, function () {
return {
restrict: ‘E’,
templateUrl: ‘Home.html’,
controllerAs: ‘Home’,
controller: function ($scope, $reactive, $meteor, $stateParams) {
// All Logic for Home page goes here
}
}
}
});

Now what I want to do is set session in Login page and get the same session value in Home page.How can I do it ?

I tried this code

angular.module(‘MyApp’).directive(‘login’, function () {
return {
restrict: ‘E’,
templateUrl: ‘login.html’,
controllerAs: ‘login’,
controller: function ($scope, $reactive, $meteor, $stateParams) {
// All Logic for login page goes here
// I check if the user exists in database and then set session as
Session.set(“allowed”,“yes”);
}
}
}
});

Now when I set this session How can I get the value of above set session in Home page.If I try

angular.module(‘MyApp’).directive(‘Home’, function () {
return {
restrict: ‘E’,
templateUrl: ‘Home.html’,
controllerAs: ‘Home’,
controller: function ($scope, $reactive, $meteor, $stateParams) {
// All Logic for Home page goes here
Session.get(“allowed”);
}
}
}
});

I get the value of session as undefined. So I wanted to know if is there any way where the session value can be set in on template and then can be globally accessed by all templates in order to maintain the session?

Is there any other way where I can check if the user is logged in ??indent preformatted text by 4 spaces