I am currently learning angular JS. I cooked this up one day: app.factory(« user », function($http, $q) { var user = {}; // query logged in status on initial page load $http.get(« /loggedin »).success(function() { user.isLogged = true; }).error(function() { user.isLogged = false; }); user.
from Pocket
Source