I’m trying to read Input’s value on input change l...
# compose-web
s
I’m trying to read Input’s value on input change like this:
Copy code
Input(type = InputType.Text, attrs = {
    onInput {
        console.log(it.nativeEvent.target.asDynamic().value)
    }
})
Is there a more elegant/safe way of doing it (alternative to
WrappedInputEvent.nativeEvent.target.asDynamic().value
)?
u
Samuel, as of now - now, there's not. We recognize that this is (to put it mildly) not something users are ok with and working on designing convenient API. Not having public roadmap - and hating making promises - I think it's still safe to say that something noticeably mature we'll push in next two-three weeks.
🙏 2
👍 3
h
You could cast
target
to HTMLInputElement, which has the typed
value
attribute. In theory!, this cast is save, as every event has a target attribute, and for this handler, the target should always be a HTMLInputElement
🙏 1
👍 1