Bind properties from inside of component init() method #3560
Replies: 3 comments 1 reply
-
|
You are after |
Beta Was this translation helpful? Give feedback.
-
Alpine.bind(this.$root, this.componentProps.bind(this)) |
Beta Was this translation helpful? Give feedback.
-
|
Thank you guys both. That is what I was looking for. Maybe you should update the docs to explain to the readers that when using Alpine.bind, for the first param, you can use function name that will be called on the element you want to bind properties or you can pass an element you want to bind properties onto. That is important feature, because enables developers to create standalone components. Once again, thanks! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I would like to bind Alpine's component properties in the component init() method. Do not now if this is somehow possible, but it would be cool if we could do that. Look at the example:
And then using it in HTML like this
What do you think about that?
Beta Was this translation helpful? Give feedback.
All reactions