Oct 21, 2019 in Vue.JS

How do you implement two-way binding?

1 Answer

0 votes
Oct 21, 2019

You can use the v-model directive to create two-way data bindings on form input, textarea, and select elements. Lets take an example of it using input component,

<input v-model="message" placeholder="Enter input here">
<p>The message is: {{ message }}</p>

Remember, v-model will ignore the initial valuechecked or selected attributes found on any form elements. So it always use the Vue instance data as the source of truth.

Click here to read more about Vue JS
Click here to read more about Insurance