featureRequest: Blur ion-input
See original GitHub issueFeature Request
Ionic version: [x] 4.x
my ionic info:
Ionic CLI : 5.4.13
Ionic Framework : @ionic/angular 4.11.7
@angular-devkit/build-angular : 0.803.21
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0
I wanted to blur an ion-input but that’s not working as expected. It just does nothing. No error Messages.
Here’s what I did:
<form (ngSubmit)="safe()">
<ion-input #name [(ngModel)]="name" name="name"></ion-input>
</form>
@ViewChild('name' , { read: ElementRef, static: false }) name: ElementRef;
//static=true doenst work either
safe(){
this.name.nativeElement.blur();
// or this: this.name.nativeElement.setBlur();
}
Is there any other way to blur an ion-input? I didn’t find any functions in the console.log() of the ion-input that could provide such functionality…
I know that ion-input can trigger functions on (ionBlur) but that’s not what I mean…
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
featureRequest: Blur ion-input · Issue #20215 · ionic ... - GitHub
I wanted to blur an ion-input but that's not working as expected. It just does nothing. No error Messages. Here's what I did:....
Read more >How to detect onfocus and blur event of ion-searchbar in ionic2?
To catch focus / blur events on searchbar you should use (ionFocus) and (ionBlur) instead of Angular's (focus) and (blur).
Read more >Override ion-valid for formgroup in reactive validation - ionic-v3
Folks, I've been trying to create a reactive validation for my register form in angular. Since I want either at least one or...
Read more >ion-refresher background color - You.com | The search engine you ...
Describe the Feature Request Basically like any other component have an color option to match the ion-refresher with any ion-content background color.
Read more >angular/angular - Gitter
So basically my servers API will return a json string on a 422 response. Angular used to convert this for me so i...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
thanks @liamdebeasi it worked for me!
Thanks for the follow up. As @cmer4 mentioned, handling blur/focus is a bit inconsistent across browsers (Safari/iOS typically adds additional restrictions around blur/focus).
I was able to reproduce the behavior you are describing. There is no
setBlur
orblur
method onion-input
; however, we do expose the nativeinput
element which can be used to call the blur method. We typically recommend developers just use that method.I tried this in your application, and it worked fine. I am going to close this issue. Thanks!