-
Notifications
You must be signed in to change notification settings - Fork 421
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
Mixin component as attributes #648
Comments
The arguments passing style isn't great, but overall, I like it. |
@whitecolor Do you still support this issue? Hopefully, The problem with something like:
Is "who owns" the template? I think a better solution would be enabling Components that don't have a "template" or "tag" property to be added via
Thoughts? |
Related: #1376 |
What is the goal here, why do you want to have components as attributes rather than tags? |
first reaso was to have "headless" components (without wrapping tag), another reason multiple components on one element. I'm not sure if it really appropriate. |
Headless components makes sense, I'm not understanding the reason behind multiple though... can.view.attr is great for mixins and #1376 has a way to make a higher-level plugin for those. |
yes multiple components ont a big issue Headless components would be intresting to have though. |
I like suggestion here, essentially a component with no tag and no template, allow that to be passed into |
I think this would be fine. |
Adding the label can-component. I'm going to try to run through all component related issues and move them as a group to the can-component repo. My hope is that I can consolidate some of them. |
Closing for: canjs/can-stache#15 |
VOTE HERE
Injecting (attaching) components via attributes
components my-comp and another-comp should be attached to the div element (in specified order), so it would be quite the same as template markup:
but resulting DOM won't include wrapping tags: "my-comp" and "another comp" and all the events will be bound to "div" element.
A component can also be attached to custom tags:
To allow this for components to be injected via attributes they could be declared as:
Passing attributes
Would take myCompoOptions from parent scope and mix (extend) them into my-comp initial scope (with two-way binding)
Or attributes could be passed individually
Accessing scopes on the element
Well can.scope API could be extended to allow this
if "tagName" fits to one of the "attached" components it will work with corresponding scope if no it will treat "tagName" as "attr" argument and work with default scope.
Extending component with other components
As upper suggestions assume actually ability to have several components on the element and some kind of multiple inheritance we could also extend component while definition:
"attach" property here is an array because the order of injecting of components is significant
so putting
would be the same as
The text was updated successfully, but these errors were encountered: