Using event on TextField to get value immediately


#1

Hello everyone!

I want to get TextField value on every change but I don`t know how to do that. I have tried this:

<TextField #inputField (keyup)=“func(inputField.value)”>

but this didn`t work.

Finally, I want to make text formatting. When user is typing binary number (Ex. 11110000), it has to automatically insert space between (Ex. 1111 0000).


#2

NativeScript fires event for every change on a property, since you want to monitor text changes, you need textChange event.

But if your purpose is to mask input, doing it on textChange may not be feasible at least on Android. Try this plugin.


#3

Thank you! It`s done! :slight_smile: