angularjsngroutereroute

ngRoute - re-route to current location path


Is it possible with ngRoute to route to the current path? Essentially, I have a scenario where my app will route to a controller/view, then after a little bit of time an event handler can be executed in another part of the application which changes a global object, and the same controller/view should be executed again. I tried just routing to the same path (using location.path), but it appears that ngRoute ignores the request it the apps is currently on that path.


Solution

  • Going by the documentation you can use the $route.reload() method:

    Causes $route service to reload the current route even if $location hasn't changed.

    As a result of that, ngView creates new scope and reinstantiates the controller.