Skip to content

Commit

Permalink
fix issue with app not refreshing when first enabled; addresses issue a…
Browse files Browse the repository at this point in the history
  • Loading branch information
btford committed Dec 12, 2012
1 parent d53b9ab commit dcd8a92
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions js/directives/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});

Expand Down

0 comments on commit dcd8a92

Please sign in to comment.