IONIC Autocomplete option in search text not disappearing after selection

扶醉桌前 提交于 2019-12-11 06:47:54

问题


I have two segments on my page that switches the selection list on the page upon toggling them

<ion-segment [(ngModel)]="changeCart" color="primary">
        <ion-segment-button value="includeSeg" (ionSelect)="onSetEnclude()">
          <ion-icon name="add"></ion-icon>
        </ion-segment-button>
        <ion-segment-button value="excludeSeg" (ionSelect)="onSetExclude()">
          <ion-icon name="remove"></ion-icon>
        </ion-segment-button>
      </ion-segment>

Under this segment there were two respective search tool bar which will be displayed to the based on the active segment. When the user manually types something, the list is displayed under this and the user able to select one from it. But then after, if the user toggles the segment, the list displayed on the screen until the user starts typing in on the corresponding search element. Then the incorrect list disappears and the right list appears

When the user toggles the segment, Is there a way to either clean the list or hide the ion-list.


回答1:


You could make those lists show or hide depending on that ngModel value. You could do this by adding a class to the ion-input.

<ion-input [class.hideList]="changeChart!=='includeSeg'">
...

and in the css:

.hideList {
   .theListsClassName{
       display: none;
   }
}


来源:https://stackoverflow.com/questions/52571622/ionic-autocomplete-option-in-search-text-not-disappearing-after-selection

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