Property '_options' does not exist on type 'PlayerPage'


#1

I try create slides with custom options,and i have this error on constructor:

@Component({
    selector: 'page-player',
    //templateUrl: 'player.html',
    template: `
      <ion-content class="has-header">
            <ion-slides  [options]="_options" #mySlider>
              <ion-slide *ngFor="let testSlide of testSlides">
                <img src="http://placehold.it/150x150">
                </ion-slide>
            </ion-slides>
            <div class="swiper-button-next"></div>
            <div class="swiper-button-prev"></div>
      </ion-content>
      `
})
export class PlayerPage {

    greeting: string;
    testSlides: string[] = [];
    @ViewChild('mySlider') mySlider: any;

    constructor(public navCtrl: NavController) {
        this._options = {
            slidesPerView: 3,
            pager: true,
            nextButton: ".swiper-button-next",
            prevButton: ".swiper-button-prev",
            onInit: () => {
            }
        }
        setTimeout(() => {
            for (var i = 1; i < 6; i++) {
                this.testSlides.push("Slide - " + i);
            }
        }, 100);
    }

    ionViewDidLoad() {
        console.log('Hello PlayerPage Page');
    }

}

This is error:

Property '_options' does not exist on type 'PlayerPage'.

      L30:  constructor(public navCtrl: NavController) {
      L31:      this._options = {
      L32:          slidesPerView: 3,

#2

You need to declare _options

@ViewChild('mySlider') mySlider: any;
_options: any;

#3

thx works fine :slight_smile: