agneta.directive('AgTabs',function($routeParams,$location, $timeout){
  var vm = this;

  vm.select = function(name) {
    vm.activeSection = name;
    var query = $location.search();
    query.tab = name;
    $location.search(query);
    $timeout(function(){
      vm.$emit('tab-change',name);
    },100);
  };

  if($routeParams.tab){
    vm.select($routeParams.tab);
  }
  else if(vm.activeSection){
    vm.select(vm.activeSection);
  }

});

@@ -108,16 +108,26 @@
 ion(name
+,noHistory
 ) %7B%0A    
@@ -212,16 +212,31 @@
 ame;%0A   
+ var location =
  $locati
@@ -253,16 +253,67 @@
 query);%0A
+    if(noHistory)%7B%0A      location.replace();%0A    %7D%0A
     $tim
@@ -436,16 +436,21 @@
 rams.tab
+,true
 );%0A  %7D%0A 
@@ -511,16 +511,21 @@
 tion
+,true
 );%0A  %7D%0A%0A
 %7D);%0A
@@ -520,12 +520,237 @@
 );%0A  %7D%0A%0A
+  vm.$on('$routeUpdate', function() %7B%0A    var check = $location.search();%0A    if(!check.tab)%7B%0A      return;%0A    %7D%0A    if (%0A      check.tab == vm.activeSection%0A    ) %7B%0A      return;%0A    %7D%0A    vm.select(check.tab,true);%0A  %7D);%0A%0A
 %7D);%0A

Improve tab navigation with history push