Answers for "ion input set blur"

1

ion input blur programmatically

In your view:
<ion-input type=“number” #myNumberInput>

In your component.ts you get the element as a view-child:
@ViewChild('myNumberInput', { static: false }) myNumberInput: IonInput;

And then you can blur the element from anywhere in your code by bluring the inner input-element:
this.myNumberInput.getInputElement().then(
    inputElement => inputElement.blur()
);
Posted by: Guest on April-08-2021

Browse Popular Code Answers by Language