fix issue with app not refreshing when first enabled; addresses issue #41

test-unit-sauce
Brian Ford 12 years ago
parent d53b9ab7de
commit dcd8a92708

@ -31,24 +31,16 @@ panelApp.directive('batTabs', function ($compile, $templateCache, $http) {
panes.push(pane); panes.push(pane);
}; };
// TODO: remove this (newVal === oldVal ?)
var first = true;
appContext.getDebug(function (result) { appContext.getDebug(function (result) {
$scope.enable = result; $scope.enable = result;
$scope.$watch('enable', function (newVal, oldVal) { $scope.$watch('enable', function (newVal, oldVal) {
// prevent refresh on initial pageload appContext.setDebug(newVal);
if (first) { if (!newVal) {
first = false; $scope.lastPane = $scope.currentPane;
$scope.select($scope.panes[$scope.panes.length - 1]);
} else { } else {
appContext.setDebug(newVal); $scope.select($scope.lastPane);
if (!newVal) {
$scope.lastPane = $scope.currentPane;
$scope.select($scope.panes[$scope.panes.length - 1]);
} else {
$scope.select($scope.lastPane);
}
} }
}); });