Last active
August 21, 2016 18:27
-
-
Save d7my11/96dac8e441b6d677b8a8816e0983e620 to your computer and use it in GitHub Desktop.
angular change state without reload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$location.url("/newUrl/" + scope.post.slug, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in
app.js
page add this to yourrun
method