Reputation: 3028
In {N}, I've got a TextField and would like to call a function when the focus is lost.
I've looked at the returnPress event - but that doesn't seem to be invoked on losing focus.
I've got text="{{ property }}" set - it gets called on every key input. I just need it at the end of the input.
Upvotes: 3
Views: 3236
Reputation: 3550
A little while ago I added the blur
event so you can now do blur="{{ onBlur }}"
or (blur)="onBlur()"
in case you're working on an Angular app.
And just so you know, there's currently a PR pending to add the focus
as well.
Both of these are/will be available for TextField
and TextView
.
Upvotes: 3
Reputation: 1101
Here how you can envoke function as soon as you press the return key from keyboard -
<TextField #secondTx hint="Phone*" row="1" colspan="4" autocorrect="false" returnKeyType="done" (returnPress)="YourFunction(secondTx.text)" [(ngModel)]="phoneNumber" keyboardType="phone" ></TextField>
Let me know if it doesn't work! Thanks
Upvotes: 0