Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 648
supertrall Avatar asked Jun 02 '14 08:06

supertrall


2 Answers

If you want to reload the complete page instead of route refresh inject the $window service and call location.refresh

$window.location.reload();

like image 107
Chandermani Avatar answered Sep 30 '22 19:09

Chandermani


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.

like image 22
Frank Marcelo Avatar answered Sep 30 '22 19:09

Frank Marcelo