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);
};
// 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);
}
});