(ionInput) dosen't work on --prod build


#1

I have a simple searchbar. (ionInput) works great in both android and web in debug build .
but the event never triggers in --prod build on both platforms.
Even a simple console.log() doesn’t work.

HTML :

<ion-searchbar [(ngModel)]=“cher” placeholder=“Search” (ionInput)=“log()” >

Ts:

log() { console.log(“why”) }


(I have the latest version in everything in my package.json )
ionic-angular": “3.9.2
angular”: “5.1.2”


#2

It’s a bit odd to have both double-bound ngModel and ionInput. Maybe they are competing. I’ve successfully listened to formControl.valueChanges() in production builds. So you have [formControl]=“nameOfFormControl”. You listen to the formControl Observable with a debounce.

nameOfFormControl: FormControl = new FormControl();
this.textFilter = this.nameOfFormControl.valueChanges.debounceTime(250)
                                             .startWith('');

This has the added advantage of not using ngModel.


#3

fixed my issue by installing: npm install @ionic/app-scripts@3.1.7 --save-dev --save-exact .

source : https://github.com/ionic-team/ionic/issues/13718