1

Well,I want to hide pagination.Like below.

constructor(public mainService: MainService) {

        mainService.getData().subscribe(datas => {

            if (datas.length >= 2) {
                this.slides.pager = true;
            } else {
                this.slides.pager = false;
            }

            this.handleData(datas);
        });
}

I remove pager from <ion-slides> in html.I want to control pagination's showing status by the code.And when the code this.slides.pager=true executed, the pagination still can't show.

David
  • 571
  • 3
  • 9
  • 18

2 Answers2

1

// just you can pass the input pager from template.

<ion-slides [pager]="slides?.pager = true"> // OR <ion-slides [pager]="datas?.length >= 2">

  <ion-slide style="background-color: green">
    <h2>Slide 1</h2>
  </ion-slide>

  <ion-slide style="background-color: blue">
    <h2>Slide 2</h2>
  </ion-slide>

</ion-slides>
mayur
  • 3,558
  • 23
  • 37
0

I solve this problem, <ion-slides pager={{pager}}>,I contol pager's value true or false in xxx.component.ts file.

David
  • 571
  • 3
  • 9
  • 18