angularjs clear history when view loaded

angularjs

Solution

in your Controller inject $scope and $location.

$scope.$on('$viewContentLoaded', function(){
  //view loaded do some stuff.
    $location.replace(); //clear last history route
});

Problem

Is there a way of clearing the history that Angular JS stores when a particular view is loaded through the `routeProvider`? I am creating a public installation using angular and the history is going to build up a lot so I want to clear it when the home page is loaded.

Original source