I am developing a simple web application using angularjs. The application logs in using Facebook connect and then lists data.
I am able to login using Facebook but I don't know how to use $cookie for the web app and access that.
Can anyone can explain how to do that?
I am using the 'ngCookies' module.
Here is the code :
myapp.controller('CookieController', [ '$scope', '$cookies', '$cookieStore',
function($scope, $cookies, $cookieStore) {
$scope.setCookie = function(key, value) {
$cookieStore.put(key, value);
$cookies.first_name = value;
};
$scope.getCookie = function(key) {
return $cookieStore.get(key);
};
$scope.doLogin = function() {
$scope.setCookie("loggedin", "true");
};
$scope.doLogout = function() {
$scope.setCookie("loggedin", "");
};
} ]);