How to do auto-complete in ionic 2 (search-bar)

孤街醉人 提交于 2019-12-03 11:54:08

In order to achieve that, you just need to add a small thing to your code. Please take a look at this plunker.

Like you can see there, with the showList variable we can show the results only after the user has searched something.

  <ion-list *ngIf="showList">
    <ion-item *ngFor="let item of items">
      {{ item }}
    </ion-item>
  </ion-list>

We first set that variable to false in the constructor and then we set it to true inside the getItems(...) method.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!