1

I have a slider jquery plugin that rotate some images in timer. Its a minified version so i can't read the source. What i wanted to do is everytime the slide change, i want to automatically update an angular model. that model therefore will update some content on the page. How can i make angular track the change triggered by jquery?

1 Answer 1

1

Your Slider probably has some kind of documentation, check that out and look for anything about events. ( jQuery sliders usually broadcast an event on the slider element when things happen - slide change for example )

Then in your code set a listener on your slider event that get's triggered by the event. Inside that listeners callback, change the model, and call $scope.$apply(); if needed.

Example with slickslider:

$('.your-element').on('beforeChange', function(event, slick, currentSlide, nextSlide){
  yourModel = nextSlide;
});

where:

$('.your-element') is a selecting the slider element

beforeChange is an event that the plugin broadcasts right before it changes the current slide

Sign up to request clarification or add additional context in comments.

1 Comment

You right. FInally I found the docs on the internet. Thanks :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.