Skip to content

Automatically initialize components #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
stancl opened this issue Mar 9, 2021 · 0 comments
Open

Automatically initialize components #3

stancl opened this issue Mar 9, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@stancl
Copy link
Member

stancl commented Mar 9, 2021

We'll do this in 0.2.x once alpinejs/alpine#1166 is merged

init() is aware of the component data & element (unlike the constructor), so it can add HTML attributes similarly to x-spread. Combined with automatic invocation of init(), it will be possible to use this package like this:

<div x-data="Alpine.component('foo')()">

And the foo component will be capable of adding attributes to the root element, setting state in init(), and everything else — automatically.

@stancl stancl self-assigned this Mar 9, 2021
@stancl stancl added the enhancement New feature or request label Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant