ionic-frameworkionic4ion-slides

Couldn't use options property of ion-slides


I have created a new app using Ionic v4 and tried adding slides to my app but I get an error stating

Can't bind to 'options' since it isn't a known property of 'ion-slides'

The html is

<ion-content padding>
   <ion-slides [options]="slideOpts">
      <ion-slide>
         <h1>Slide 1</h1>
      </ion-slide>
      <ion-slide>
         <h1>Slide 2</h1>
      </ion-slide>
      <ion-slide>
         <h1>Slide 3</h1>
      </ion-slide>
   </ion-slides>
</ion-content>

My Ts is

import { Component,ViewChild } from '@angular/core';
import { NavController } from 'ionic-angular';
@Component({
   selector: 'page-home',
   templateUrl: 'home.html'
})
export class HomePage {

   slideOpts = {
      initialSlide: 1,
      speed: 400
   };

   constructor(public navCtrl: NavController) {
   }
}

However the same worked for me in Ionic v3. Could anyone please help me out?


Solution

  • Try this.. its working fine ionic 4.0.0

     import { IonSlides } from '@ionic/angular';
    
        @Component({
          selector: 'page-home',
          templateUrl: 'home.html'
        })
        export class HomePage {
        @ViewChild(IonSlides) slides: IonSlides;
          slideOpts = {
            initialSlide: 1,
            speed: 400
          };
    
          constructor(public navCtrl: NavController) {
          }
         ngOnInit() {  this.slideOpts = {
            initialSlide: 1,
            speed: 400
          };
        }
        }