Dynamic slide height

Here is the RC5 solution.

HTML

    <div id="wrapper">
        <ion-slides #slider>
            <ion-slide *ngFor="let robot of _robots">
                your robots here
            </ion-slide>
        </ion-slides>
    </div>

You wil need the div wrapper for when the slides take up more than the length of the screen.

TS

  1. import ViewChild from @angular/core

  2. add this line to your class (anywhere is fine)

    @ViewChild('slider') slider: Slides;

  3. add this function to the class

     ngAfterViewInit() {
         this.slider.autoHeight = true;
     }
    

Thank you, Ionic Team, for making so many changes that the solution is this simple now!

4 Likes