Masherák
Masherák

Reputation: 11

Problem with binding in the Razor Components

I have problem with binding on input as shown below. After typing the first character to the input is triggered method "Evaluate" correctly, but the value on field _answer is null. When I type the next character so the value of _answer is first typed character. Binding is just one character behind.

How can I fix it?

Thank you

    <input type="text" @bind="_answer" @oninput="Evaluate"/>

Upvotes: 1

Views: 155

Answers (1)

Y Stroli
Y Stroli

Reputation: 359

oninput gets triggered before input is typed, use onchange instead.

Upvotes: 1

Related Questions