tombatossals / angular-leaflet-directive

AngularJS directive to embed an interact with maps managed by Leaflet library
http://tombatossals.github.io/angular-leaflet-directive
MIT License
1.5k stars 635 forks source link

Popup $destroy #1037

Open matodrobec opened 8 years ago

matodrobec commented 8 years ago

$destroy event is not triggered after the popup is closed.

app.directive('mapDetailPopup', function () {
    return {
        restrict: 'E',
        link: function (scope) {
            var timerId = null;

            timerId = setInterval(function () {
                console.log('interval');
            }, 2000);

            scope.$on('$destroy', function () {
                clearInterval(timerId);
                console.log('destroy');
            });
        }
    }
});

popup destroy example

Is there way how can I remove the timer?

vincent-ollivier-everysens commented 8 years ago

+1. It's a big problem ! Someone has a trick ?

vincent-ollivier-everysens commented 8 years ago

I corrected it on ui-leaflet : Issue 240