I’ve got a shopping cart, when I click on an item in the shopping cart, I expect a modal to pop-up and display more images in a slide-box format.
I’ve got it working the first time I open the modal and it closes fine. However, once I start clicking on other items in the shopping cart, the modals open up but they’re all messed up. The slidebox stops working, different slides in the slidebox start overlapping, and it almost looks as if the scope gets removed from the modal because click events stop working.
The slides in the modal are created with an ng-repeat on a div as seen here :
<ion-slide-box class='image-slider-box' does-continue='true'>
<ion-slide ng-repeat='image in product.image' class='image-slide'>
<ion-content>
<img src='{{image}}' class='image-slide'>
</ion-content>
</ion-slide>
</ion-slide-box>
Here is the code in my directive :
$ionicModal.fromTemplateUrl('views/partials/cart-image-modal.html', {
animation: 'slide-left-right',
scope: scope
}).
then(function(modal){
scope.modal = modal;
});
scope.openModal = function() {
scope.modal.show();
$timeout( function() {
$ionicSlideBoxDelegate.update();
});
};
scope.closeModal = function() {
scope.modal.hide()
.then(function(){
scope.modal.remove();
});
};
Please let me know if I’m missing anything!