diff --git a/src/ui-router-tabs.js b/src/ui-router-tabs.js index 3fe0f81..0914805 100644 --- a/src/ui-router-tabs.js +++ b/src/ui-router-tabs.js @@ -88,13 +88,15 @@ angular.module('ui.router.tabs').directive('tabs', ['$rootScope', '$state', }; // initialise tabs when creating the directive - $scope.update_tabs(); - - // if none are active, set the default - if (!$scope.current_tab) { - $scope.current_tab = $scope.tabs[0]; - $scope.go($scope.current_tab.route, $scope.current_tab.params, $scope.current_tab.options); - } + if($state.current.name) { + $scope.update_tabs(); + + // if none are active, set the default + if (!$scope.current_tab) { + $scope.current_tab = $scope.tabs[0]; + $scope.go($scope.current_tab.route, $scope.current_tab.params, $scope.current_tab.options); + } + } }], templateUrl: function(element, attributes) { return attributes.templateUrl || 'ui-router-tabs-default-template.html';