1

How to reload an external controller in angularjs ?

From a template, I want change and reload it :

 $location.path("/pageToReload"); 

1 Answer 1

4

I guess you want to reload the current page. You can use the reload method of either the $route or the $window service. Inject the service in your controller and then create a method reloadPage on your $scope :

$scope.reloadPage = function() {
   $route.reload();
}

Or with $window :

$scope.reloadPage = function() {
   $window.location.reload();
}

You can then call those methods from your template with, for instance, this directive :

ng-click="reloadPage()"
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.