Skip to content

Instantly share code, notes, and snippets.

@d7my11
Last active August 21, 2016 18:27
Show Gist options
  • Save d7my11/96dac8e441b6d677b8a8816e0983e620 to your computer and use it in GitHub Desktop.
Save d7my11/96dac8e441b6d677b8a8816e0983e620 to your computer and use it in GitHub Desktop.
angular change state without reload
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]);
};
$location.url("/newUrl/" + scope.post.slug, false);
@d7my11
Copy link
Author

d7my11 commented Aug 21, 2016

in app.js page add this to your run method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment