Ion-slides doesn't work properly with ng-include


#1

If I use ion-slides normally in a view, then it works fine but my current design requires using ion-slides in ion-item (swipe-able item I may say), and these items will be inside of a tab which will get dynamically loaded through ng-include

The issue happens when I switch back and forth between tabs, when I switch to another tab then switch back, the internal data of the Swiper instance is lost.

I assume Swiper instance is initialized upon page load, that instance itself is fine, it still has all the functions and attributes but when I call functions on it, like lockSwipes(), the internal variable ‘s’ is null.

I see the line ‘var s = this;’ and all functions and attributes are attached to it, so I don’t get why it is null.

Is there a way to force re-initialization of ion-slides when I switch tabs? Or is there a better approach?

UPDATE:

I found out the cause of it. If I lockSwipe() before I switch to another tab then switch back, I get the null issue, however if I unlockSwipe() before I switch, I don’t have any issue when I switch back. Yet still I don’t get it.