diff --git a/src/ui-router-tabs.js b/src/ui-router-tabs.js index 4ba80de..864641b 100644 --- a/src/ui-router-tabs.js +++ b/src/ui-router-tabs.js @@ -83,6 +83,12 @@ angular.module('ui.router.tabs').directive('tabs', ['$rootScope', '$state', // if none are active, set the default $scope.current_tab = $scope.current_tab || $scope.tabs[0]; $scope.go($scope.current_tab.route, $scope.current_tab.params, $scope.current_tab.options); + + $scope.changeTab = function(tab) { + if (tab.route !== $scope.current_tab.route) { + $scope.go(tab.route, tab.params, tab.options); + } + }; }], templateUrl: function(element, attributes) { return attributes.templateUrl || 'ui-router-tabs-default-template.html'; @@ -92,9 +98,7 @@ angular.module('ui.router.tabs').directive('tabs', ['$rootScope', '$state', function($templateCache) { var DEFAULT_TEMPLATE = '
' + '' + - ' ' + - ' ' + + ' ' + '' + '
';