I want to get cookie value from one UI to another page.
That cookie value is user name. EX:Nithya
When i logged to the home page the cookie value is empty the cookie value is set set after refreshing a page.
I want to set the cookie value when the load is load.
this is my home page Controller code
app.controller('homeCtrl',
function ($scope, $http, $window, $filter, $cookieStore) {
var logincheck = function () {
$http.get('loggedin').success(function (user) {
console.log(user);
$cookieStore.put('LoggedinUser', user);
$scope.LoggedinUsers = $cookieStore.get('LoggedinUser');
});
};
logincheck();
});
i am using the cookie in this code.
app.controller('RoleViewCtrlq', ['$scope', '$http', '$window', '$filter', '$cookieStore', '$notify', '$timeout',
function ($scope, $http, $window, $filter, $cookieStore, $notify, $timeout)
{
var username = $cookieStore.get('LoggedinUser');
}]);
can anyone give the solution..
Thanks
via M.Nithya
No comments:
Post a Comment