Skip to content

Commit

Permalink
STATISTIK-1211 Fixat problem med icke existerande objekt. I Firefox o…
Browse files Browse the repository at this point in the history
…ch IE fick man fel i konsollen när man försökte byta från en controller-sida när man blivit utloggad.
  • Loading branch information
fredrikengstrom committed Aug 17, 2015
1 parent 3bcaa79 commit 4965e6a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,31 +301,31 @@ function ($scope, $rootScope, $window, $timeout, statisticsData, $routeParams, p
};

$scope.$on('$destroy', function() {
if(typeof perMonthAlterationChart.destroy === 'function') {
if(perMonthAlterationChart && typeof perMonthAlterationChart.destroy === 'function') {
perMonthAlterationChart.destroy();
}

if(typeof newSexProportionChart.destroy === 'function') {
if(newSexProportionChart && typeof newSexProportionChart.destroy === 'function') {
newSexProportionChart.destroy();
}

if(typeof oldSexProportionChart.destroy === 'function') {
if(oldSexProportionChart && typeof oldSexProportionChart.destroy === 'function') {
oldSexProportionChart.destroy();
}

if(typeof ageDonutChart.destroy === 'function') {
if(ageDonutChart && typeof ageDonutChart.destroy === 'function') {
ageDonutChart.destroy();
}

if(typeof diagnosisDonutChart.destroy === 'function') {
if(diagnosisDonutChart && typeof diagnosisDonutChart.destroy === 'function') {
diagnosisDonutChart.destroy();
}

if(typeof degreeOfSickLeaveChart.destroy === 'function') {
if(degreeOfSickLeaveChart && typeof degreeOfSickLeaveChart.destroy === 'function') {
degreeOfSickLeaveChart.destroy();
}

if(typeof sickLeaveLengthChart.destroy === 'function') {
if(sickLeaveLengthChart && typeof sickLeaveLengthChart.destroy === 'function') {
sickLeaveLengthChart.destroy();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ angular.module('StatisticsApp').controller('casesPerCountyCtrl', ['$scope', '$ro
};

$scope.$on('$destroy', function() {
if(typeof chart.destroy === 'function') {
if(chart && typeof chart.destroy === 'function') {
chart.destroy();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ angular.module('StatisticsApp').controller('columnChartDetailsViewCtrl', [ '$sco
};

$scope.$on('$destroy', function() {
if(typeof chart.destroy === 'function') {
if(chart && typeof chart.destroy === 'function') {
chart.destroy();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,11 @@ angular.module('StatisticsApp').controller('doubleAreaChartsCtrl', [ '$scope', '
};

$scope.$on('$destroy', function() {
if(typeof chart1.destroy === 'function') {
if(chart1 && typeof chart1.destroy === 'function') {
chart1.destroy();
}

if(typeof chart2.destroy === 'function') {
if(chart2 && typeof chart2.destroy === 'function') {
chart2.destroy();
}
});
Expand Down
12 changes: 6 additions & 6 deletions statistik-web/src/main/webapp/js/app/controller/overviewCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,27 +297,27 @@ angular.module('StatisticsApp').controller('overviewCtrl', [ '$scope', '$rootSco
};

$scope.$on('$destroy', function() {
if(typeof perMonthAlterationChart.destroy === 'function') {
if(perMonthAlterationChart && typeof perMonthAlterationChart.destroy === 'function') {
perMonthAlterationChart.destroy();
}

if(typeof ageDonutChart.destroy === 'function') {
if(ageDonutChart && typeof ageDonutChart.destroy === 'function') {
ageDonutChart.destroy();
}

if(typeof diagnosisDonutChart.destroy === 'function') {
if(diagnosisDonutChart && typeof diagnosisDonutChart.destroy === 'function') {
diagnosisDonutChart.destroy();
}

if(typeof degreeOfSickLeaveChart.destroy === 'function') {
if(degreeOfSickLeaveChart && typeof degreeOfSickLeaveChart.destroy === 'function') {
degreeOfSickLeaveChart.destroy();
}

if(typeof sickLeaveLengthChart.destroy === 'function') {
if(sickLeaveLengthChart && typeof sickLeaveLengthChart.destroy === 'function') {
sickLeaveLengthChart.destroy();
}

if(typeof sickLeavePerCountyChart.destroy === 'function') {
if(sickLeavePerCountyChart && typeof sickLeavePerCountyChart.destroy === 'function') {
sickLeavePerCountyChart.destroy();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ angular.module('StatisticsApp').controller('singleLineChartCtrl', [ '$scope', '$
};

$scope.$on('$destroy', function() {
if(typeof chart.destroy === 'function') {
if(chart && typeof chart.destroy === 'function') {
chart.destroy();
}
});
Expand Down

0 comments on commit 4965e6a

Please sign in to comment.