1 !function(angular, undefined) { 'use strict';
3 angular.module('ngLocationUpdate', [])
4 .run(['$route', '$rootScope', '$location', function ($route, $rootScope, $location) {
5 // todo: would be proper to change this to decorators of $location and $route
6 $location.update_path = function (path, keep_previous_path_in_history) {
7 if ($location.path() == path) return;
9 var routeToKeep = $route.current;
10 $rootScope.$on('$locationChangeSuccess', function () {
12 $route.current = routeToKeep;
18 if (!keep_previous_path_in_history) $location.replace();