if user is logged in, how to restrict the back button, or accessing the login page directly in angularjs
<p>I am trying to implement basic login, logout functionality using angular JS, On successfull login then only My header has to be appeared. 
once the user is logged in. until he is logged out, if he try to access the login route directly it should redirect to the dash board.</p>

<p>How to achieve this..? i need help in this matter.
I have access token stored in the cookie. which will let us know if the user is logged in or not..
if logged in.. my route should not be leading to login route. </p>

<p>for the reference i am adding the code of route.</p>

<pre><code>app.config(["$routeProvider",function($routeProvider){
$routeProvider
    .when("/",{
        templateUrl : 'views/home/login.html',
        controller : 'homeCtrl'
    })

    .when("/dashboard",{
        templateUrl : 'views/home/dashboard.html',
        controller : 'dashboardCtrl',
        authenticated : true
    })

    .otherwise('/',{
        templateUrl : 'views/home/login.html',
        controller : 'homeCtrl'
    })

}]);

app.run(["$rootScope","$location","authFactory",function($rootScope,$location,authFactory){

$rootScope.$auth = authFactory;
$rootScope.$on('$routeChangeStart',function(event,next,current){

    if(next.$$route.authenticated){
        var userAuth = authFactory.getAccessToken();

        if(!userAuth){

            $location.path('/');

        }
    }
});
}]);
</code></pre>

<p>I want to restrict the route access to login page if the user is currently logged in.. </p>

<p>please help me out</p>