From dcd8a927081769e608d623ae107fbffb66bcdb5f Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Wed, 12 Dec 2012 06:32:00 -0500 Subject: [PATCH] fix issue with app not refreshing when first enabled; addresses issue #41 --- js/directives/tabs.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/js/directives/tabs.js b/js/directives/tabs.js index b3f9e6a..29ecea4 100644 --- a/js/directives/tabs.js +++ b/js/directives/tabs.js @@ -31,24 +31,16 @@ panelApp.directive('batTabs', function ($compile, $templateCache, $http) { panes.push(pane); }; - // TODO: remove this (newVal === oldVal ?) - var first = true; - appContext.getDebug(function (result) { $scope.enable = result; $scope.$watch('enable', function (newVal, oldVal) { - // prevent refresh on initial pageload - if (first) { - first = false; + appContext.setDebug(newVal); + if (!newVal) { + $scope.lastPane = $scope.currentPane; + $scope.select($scope.panes[$scope.panes.length - 1]); } else { - appContext.setDebug(newVal); - if (!newVal) { - $scope.lastPane = $scope.currentPane; - $scope.select($scope.panes[$scope.panes.length - 1]); - } else { - $scope.select($scope.lastPane); - } + $scope.select($scope.lastPane); } });