diff --git a/src/ngRoute/route.js b/src/ngRoute/route.js index 34f3f9ec05f1..de5d47bb88a1 100644 --- a/src/ngRoute/route.js +++ b/src/ngRoute/route.js @@ -440,7 +440,24 @@ function $RouteProvider(){ reload: function() { forceReload = true; $rootScope.$evalAsync(updateRoute); - } + }, + + /** + * @ngdoc method + * @name ngRoute.$route#silent + * @methodOf ngRoute.$route + * @param {string} path New location path + * + * @description + * Call $location.path(path) method without calling route controller + * for silent change current location path + */ + silent: function(path) { + $location.path(path); + $route.$$silentChangePath = $location.path(); + }, + + $$silentChangePath: false }; $rootScope.$on('$locationChangeSuccess', updateRoute); @@ -484,6 +501,12 @@ function $RouteProvider(){ } function updateRoute() { + + // don't call route controller if silent mode enabled for this path + var silentPath = $route.$$silentChangePath; + $route.$$silentChangePath = false; + if (silentPath === $location.path()) return; + var next = parseRoute(), last = $route.current;