Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49232

ionInput triggers when closing keyboard

$
0
0

@yasirpanjsheri wrote:

.html:

 <ion-searchbar
        #input
        [(ngModel)]="searchTerm"
        [formControl]="searchCtrl"
        (ionInput)="onSearchInput()"
        placeholder="Search...">
  </ion-searchbar>

.ts:

  ionViewDidLoad(){
      this.searchCtrl.valueChanges.debounceTime(700).subscribe(search => {
        this.searching = false;
        if (this.searchTerm !== ''){
           // do something
         } else {
         this.hideDefaultList = false;
        }
     });

  onSearchInput() {
     this.searching = true;
     this.showMessage = false;
     this.hideDefaultList = true;
   }

when closing keyboard , the function onSearchInput triggers again leading to show spinner this.searching

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49232

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>