AngularJs: Reload page

时间:2021-01-08 22:10:31
<a ng-click="reloadRoute()" class="navbar-brand" title="home"  data-translate>PORTAL_NAME</a>
$scope.reloadRoute = function() {
$route.reload();
}
$scope.reloadRoute = function() {
$window.location.reload();
}

Later edit (ui-router):

As mentioned by JamesEddyEdwards and Dunc in their answers, if you are using angular-ui/ui-router you can use the following method to reload the current state / route. Just inject $stateinstead of $route and then you have:

$scope.reloadRoute = function() {
$state.reload();
};