I've tried the solution here: https://www.consolelog.io/angularjs-change-path-without-reloading/
app.run(['$route', '$rootScope', '$location', function ($route, $rootScope, $location) {
var original = $location.path;
$location.path = function (path, reload) {
if (reload === false) {
var lastRoute = $route.current;
var un = $rootScope.$on('$locationChangeSuccess', function () {
$route.current = lastRoute;
un();
});
}
return original.apply($location, [path]);
};
}])
But the path I set it to just gets consumed and reverts back to how it was.
The default behavior of the ngRoute router is to reload the
ngViewwhen the path changes and the new URL maps to the current route.If the
reloadOnSearchoption is set tofalse, ngRoute will not reload the route when only$location.search()or$location.hash()changes:And the app invokes:
A
$routeUpdateevent is broadcast on the root scope (without reloading the route).1