Slides length and active index shows wrong (bug?)

I have 3 slides
but active index and length shows different number.
Aug-17-2017 15-26-42

<ion-slides #MainSlide autoplay="5000" loop="true" (ionSlideDidChange)="mainSlideBoxChanged()">
      <ion-slide *ngFor="let main of mainSlideSrc">
            <img [src]="main.img">
  mainSlideBoxChanged() {
    this.mainSlideActiveIndex = this.mainSlides.getActiveIndex();
    this.mainSlideIndexLength = this.mainSlides.length();

the length() method returns length + 2
the getActiveIndex() method returns actual index + 1

From the chrome dev tool, i noticed there are 5 <ion-slides>

The first slide is the last element of the 3 slides.
The last slide is the first element of the 3 slides.

In between 1st and last is the actual 3 slides.

I guess Ionic automatically adds these slides at front and back.

How can I fix this??

I had a problem similar, I have been forced to proceed to do it manually with :

  $scope.$on("$ionicSlides.slideChangeEnd", function(event, data){
    vm.activeIndex = data.slider.activeIndex;
    if(vm.activeIndex == vm.sliderImages.length+1) {
      vm.activeIndex = 0;
    } else if(vm.activeIndex == 0) {
      vm.activeIndex = vm.sliderImages.length-1;
    } else {
      vm.activeIndex = vm.activeIndex-1;
    vm.previousIndex = data.slider.previousIndex;

I think you can do it too in your case, but I’vent really used a slidebox so someone maybe can you a better answer.

Edit : It’s not the solution for your problem ! Just what I did for my problem which was similar