Is there a way to manually trigger the blur event on an ion-input
element?
The ideal scenario would be with an ionic-native method, but any javascript-based workaround will suffice.
My current configuration:
Ionic:
ionic (Ionic CLI) : 4.0.1 (/Users/rguerin/.nvm/versions/node/v6.10.1/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.1.1
@ionic/app-scripts : 1.3.7
System:
NodeJS : v6.10.1 (/Users/rguerin/.nvm/versions/node/v6.10.1/bin/node)
npm : 3.10.10
OS : macOS High Sierra
HTML file :
<div>
<ion-input (click)="openModal(fieldName)" [placeholder]="placeholder" #searchInput>
</ion-input>
</div>
Component file :
export class MyClass implements OnInit {
@ViewChild('searchInput') searchInput: any;
foo(): void {
this.searchInput.blur();
}
}
The error triggered by this.searchInput.blur()
is as follows:
TypeError: this.searchInput.setBlur is not a function. (In 'this.searchInput.setBlur()', 'this.searchInput.setBlur' is undefined)