in code , there is a watch on settings changes. when this change is made , the destroyandInit function is call, in this function the init is call .
in the init function you have on calling to initiate the event listener.
each time setting change its add one listener to the event .
to prevent this you have to :
1 - name the event with a namespace ,
2 - make a call to off before on
example :
slickness.on('swipe', function (event, slick, direction) {$timeout(function () {scope.$apply(function () {options.event.swipe(event, slick, direction);});});});
becomes :
slickness.off('swipe.slickCarousel').on('swipe.slickCarousel', function (event, slick, direction) {$timeout(function () {scope.$apply(function () {options.event.swipe(event, slick, direction);});});});
in code , there is a watch on settings changes. when this change is made , the destroyandInit function is call, in this function the init is call . in the init function you have on calling to initiate the event listener.
each time setting change its add one listener to the event .
to prevent this you have to : 1 - name the event with a namespace , 2 - make a call to off before on
example :
slickness.on('swipe', function (event, slick, direction) {
$timeout(function () {
scope.$apply(function () {
options.event.swipe(event, slick, direction);
});
});
});
becomes :slickness.off('swipe.slickCarousel').on('swipe.slickCarousel', function (event, slick, direction) {
$timeout(function () {
scope.$apply(function () {
options.event.swipe(event, slick, direction);
});
});
});