1

好吧,我想隐藏分页。如下所示。

constructor(public mainService: MainService) {

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

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

            this.handleData(datas);
        });
}

pager<ion-slides>html中删除。我想通过代码控制分页的显示状态。当代码this.slides.pager=true执行时,分页仍然无法显示。

4

2 回答 2

1

// 只是你可以pager从模板传递输入。

<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>
于 2017-02-15T05:41:38.703 回答
0

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

于 2017-02-15T05:52:03.247 回答