You can do this by using either a service or multiple controllers. Easiest way IMO is to set up a simple controller and service that is included on every page.
Something like this:
<div style='display:none;' ng-controller='RefreshController'></div>
Service:
.factory('redirect',function($rootScope){
var rScope={};
rScope.redirect=true;
rScope.set=function(){
rScope.redirect=false;
};
rScope.get=function(){
return rScope.redirect;
};
return rScope;
});
Controller:
function RefreshController($location,redirect){
if($location.path()=='/'){
redirect.set()
}
if(redirect.get()){
$location.path('/');
}
}
In a nutshell, if you are on the main page, it will set a service variable to say that you are on the home page. As long as no refresh is done, the service variable state will be static. If a refresh is done and you are not currently on the main page, the service variable will be different, and the user will be redirected to the main page.