summaryrefslogtreecommitdiffstats
path: root/js/directive
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-09-18 14:39:45 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-09-18 14:39:45 +0200
commit682f89fa8d6ad3748b0a64f4e3a1c71a6982a1d1 (patch)
tree0af5ea281e2dae3fa530cc648babe16314e77ae1 /js/directive
parentd45ce51678df7b5dcfa29d02d59962ccdbf95771 (diff)
fix delete
Diffstat (limited to 'js/directive')
-rw-r--r--js/directive/NewsTimeout.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/js/directive/NewsTimeout.js b/js/directive/NewsTimeout.js
index 0a224778f..9ac2ce47b 100644
--- a/js/directive/NewsTimeout.js
+++ b/js/directive/NewsTimeout.js
@@ -22,7 +22,8 @@ app.directive('newsTimeout', function ($timeout, $rootScope) {
// remove timeout if element is being removed by
// for instance clicking on the x button
- element.on('$destroy', function () {
+ scope.$on('$destroy', function () {
+ destroyed = true;
$timeout.cancel(timer);
});
@@ -32,6 +33,8 @@ app.directive('newsTimeout', function ($timeout, $rootScope) {
// $locationChangeStart triggers twice because of the trailing
// slash on the link which is kinda a hack to reload the route
// if you click on the link when the route is the same
+ $timeout.cancel(timer);
+
if (!destroyed) {
destroyed = true;
element.remove();