简体   繁体   中英

AngularJS – $route.reload() not working

I'm trying to reload page using $route.reload() :

var App = angular.module("App", ["ngRoute"]);  
var idx = 0;  

App.controller("List", function ($scope, $route) {
    $scope.changeWallet = function (index) {
        idx = index;
        $route.reload();
        console.log("success");
    };
}

"success" is shown in console, but nothing happens.
How can I fix this?

如果要重新加载整个页面而不是路由刷新,请注入$window服务并调用location.refresh

$window.location.reload();

The $window.location.reload() will basically refresh the page like when you're pressing F5 for refresh.

What I am after is reload the specific views in the page not refreshing the entire page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM