devmark / angular-slick-carousel

Angular directive for slick-carousel
http://devmark.github.io/angular-slick-carousel/
MIT License
353 stars 125 forks source link

Toggling enabled/disabled state cause init to fire 2x + 2 number of times disabled. #108

Open draehal opened 8 years ago

draehal commented 8 years ago

On first load, the init function is called twice. Each time the enabled state of carousel is toggled via slickSettings.enabled, init is called 2x more times. It appears that when disabled toggled to true, the listeners for init are not removed. When it is toggled to false, 2 new listeners are added for a total of 2x + 2 where x is the number of times toggled and 2 is the initial. (It should only be one)

Demo: http://embed.plnkr.co/GjGOTxC6Ub1JtBGVhd2x/