x-model on object #2230
-
Hello. I need help. Is it really possible to use HTML <form action="" x-data="Component">
<input type="text" x-model="data.name">
<input type="text" x-model="data.email">
</form> Javascript function component() {
return {
data: {
name: "",
email: "",
}
};
}
document.addEventListener("alpine:init", () => {
Alpine.data('Component', component);
}); I am using Alpinejs for browser version 3.2.2. function component() {
return {
name: "",
email: "",
};
} After some browsing, I found that this codepen worked, but I don't know exactly what version of alpine is being used. https://codepen.io/jreviews/pen/NWPMVMz I can't tell whether this is a bug or intended to work like that. Appreciate any answer. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It seems to work for me. |
Beta Was this translation helpful? Give feedback.
It seems to work for me.
https://codepen.io/SimoTod/pen/PoKZZxm