ngDefine('cockpit.services', function(module) {
  
  var SearchFactory = [ '$location', '$rootScope', function($location, $rootScope) {

    var silent = false;

    $rootScope.$on('$routeUpdate', function(e, lastRoute) {
      if (silent) {
        console.log('silenced $routeUpdate');
        silent = false;
      } else {
        $rootScope.$broadcast('$routeChanged', lastRoute);
      }
    });

    $rootScope.$on('$routeChangeSuccess', function(e, lastRoute) {
      silent = false;
    });

    var search = function() {
      var args = Array.prototype.slice(arguments);

      return $location.search.apply($location, arguments);
    }

    search.updateSilently = function(params) {
      angular.forEach(params, function(value, key) {
        $location.search(key, value);
      });

      silent = true;
    };

    return search;
  }];

  module.factory('search', SearchFactory);
});
@@ -239,54 +239,8 @@
 ) %7B%0A
-        console.log('silenced $routeUpdate');%0A
     
@@ -639,24 +639,65 @@
 n(params) %7B%0A
+      var oldPath = $location.absUrl();%0A%0A
       angula
@@ -782,24 +782,105 @@
 %0A      %7D);%0A%0A
+      var newPath = $location.absUrl();%0A      %0A      if (newPath != oldPath) %7B%0A  
       silent
@@ -888,16 +888,24 @@
 = true;%0A
+      %7D%0A
     %7D;%0A%0A

fix $routeChange silencing directive