Closed
Description
I currently use the following code to prevent my route, and therefore controller, being reloaded when I update the $location:
angular.module('Shared').service('location', function($location, $route, $rootScope) {
$location.skipReload = function () {
var lastRoute = $route.current;
var un = $rootScope.$on('$locationChangeSuccess', function () {
$route.current = lastRoute;
un();
});
return $location;
};
return $location;
});
along with:
location.skipReload().path("/newpath").replace();
Can I achieve the same behaviour with ui-router?
I tried simply replacing $route
above with $state
but this still resulted in a state change. My use case is I only have 'new' and 'edit' states which are exactly the same, when a user saves within the 'new' state I want to update the URL to include the saved id but not reload the view.
Metadata
Metadata
Assignees
Labels
No labels