ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.09k stars 13.51k forks source link

RC5 - Error in :0:0 caused by: Cannot set property 'paginationClickable' of undefined #10025

Closed HamzaLJ closed 7 years ago

HamzaLJ commented 7 years ago

Ionic version: (check one with "x") [ ] 1.x [ X ] 2.x

I'm submitting a ... (check one with "x") [ X ] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior: Throwing the below error:

EXCEPTION: Error in :0:0 caused by: Cannot set property 'paginationClickable' of undefined ORIGINAL EXCEPTION: Cannot set property 'paginationClickable' of undefined

Expected behavior: It should be working as per the documentation:

http://ionicframework.com/docs/v2/nightly/api/components/slides/Slides/#advanced

Related code:

    @ViewChild(Slides) cuisinesSlideOptions: Slides;

    ngAfterViewInit(){
      this.cuisinesSlideOptions.slidesPerView = 3;
      this.cuisinesSlideOptions.paginationClickable = true;
    }

HTML:

       <ion-slides pager #cuisinesSlideOptions>
        .....
      </ion-slides>
HamzaLJ commented 7 years ago

For the time being, I've rolled back to RC4, hoping that it'll be fixed soon.

wbhob commented 7 years ago

That will be fixed in RC6. They dropped the dependency for the old slider component, so some stuff got lost in the mix, but it will be available very soon in the next version.

mhartington commented 7 years ago

I think the issue is related to your code. Used the following example

  <ion-slides pager="true">
    <ion-slide style="background: red; color: white;">
      <h1>Slide 1</h1>
    </ion-slide>
    <ion-slide style="background: white; color: blue;">
      <h1>Slide 2</h1>
    </ion-slide>
    <ion-slide style="background: blue; color: white;">
      <h1>Slide 3</h1>
    </ion-slide>
    <ion-slide style="background: purple; color: white;">
      <h1>Slide 4</h1>
    </ion-slide>
    <ion-slide style="background: aqua; color: black;">
      <h1>Slide 5</h1>
    </ion-slide>
    <ion-slide style="background: goldenrod; color: white;">
      <h1>Slide 6</h1>
    </ion-slide>
  </ion-slides>
export class HomePage {
  @ViewChild(Slides) slider: Slides
  constructor(public navCtrl: NavController) {

  }
  ngAfterViewInit() {
    this.slider.slidesPerView = 3;
    this.slider.paginationClickable = true;
  }
}

And was able to set the properties correctly.

ionitron-bot[bot] commented 6 years ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.