Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carousel not destroying properly when settings object is updated. #113

Open
decodedcreative opened this issue Nov 14, 2016 · 2 comments
Open

Comments

@decodedcreative
Copy link

decodedcreative commented Nov 14, 2016

Hi,

There however seems to be a bug with the plugin where its destroy method does not properly remove slides from the carousel instance.

angular-slick.js has the following Angular Watch which is triggered every time a change is made to the settings object:

return scope.$watch('settings', function (newVal, oldVal) { if (newVal !== null) { return destroyAndInit(); } }, true);

My carousel initially loads with 15 slides and every time the destroyAndInit function is run, another 15 slides are erroneously added to the carousel. Because of this I suspect the destroy function is not working as expected. Here is the code for it:

` destroy = function () {

    var slickness = angular.element(element);
    if (slickness.hasClass('slick-initialized')) {
      slickness.remove('slick-list');
      slickness.slick('unslick');
    }

    return slickness;
  };`

Any ideas?

@ericjames
Copy link

the selector is a class so it should be slickness.remove('.slick-list');

@kryptografisch
Copy link

Furthermore the jQuery Event handlers are not removed. So after destroying and (re-)init handlers get called twice.
is there a slickness.off() jQuery call to remove handlers missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants