You're currently familiar with one-direction data binding; however, often you'll require two-way binding in your forms. It's not enough to bind a value to an input. We also need to listen for when the input's value changes, and update the underlying data. We can allow for this by using x-model
. In this episode, we'll review what precisely happens when you add this attribute to a form input. Then, as a small demo, we'll use that data to submit an AJAX request to a fake server.
View the source code for this episode on GitHub.