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?
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.