Skip to content

Adding x-bind Dynamically through Custom Directive #4492

Answered by SimoTod
mhsiddiqui asked this question in 1. Help
Discussion options

You must be logged in to vote

You need to make sure the order is correct and your custom directive is processed before bind.

Alpine.directive(...your code...).before('bind')

Im your code, you don't really need the x-bind attribute (unless it's for you to see it in the html) and you can call Alpine.bind directly in your custom directive.

You also don't need effect.

Look at the combobox component in the ui packages for an example.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@SimoTod
Comment options

SimoTod Dec 29, 2024
Collaborator

Answer selected by mhsiddiqui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants