Please see working example: http://plnkr.co/edit/46O0znC5HFDE4cYXSm5h?p=preview
Stored data in cookies in login function as follows,
$cookies.userinfo = {
'id': 1,
'name': 'pqr'
};
And on logout remove that data -
delete $cookies.userinfo;
then check for 'angular.isDefined($cookies.userinfo)' (userinfo is cookie name which given at the time of storing data in it) if find then redirect it to your page which you want to see after login. i.e
app.run(function ($cookies) {
$rootScope.$on("$routeChangeStart", function () {
if (angular.isDefined($cookies.userinfo)) {
$location.path("/pathname");
}
});
});