Skip to content

Tag in element without attribute name should apply its value's properties as attributes #1125

Closed
@PixievoltNo1

Description

@PixievoltNo1

I'd like to see a template element like <MyComponent {{myObject}}> take all the properties of the tag's value and apply them to the element as attributes, e.g. if myObject is {foo: "mario", bar: "luigi"}, then the element is equivalent to <MyComponent foo="mario" bar="luigi">.

Use cases for this include tree node components, which could specify their children be displayed like so...

{{#each children as childData}}
	<:Self {{childData}}/>
{{/each}}

...and dynamic components, which may need to send arbitary data to their arbitrary component.

<:Component {name} {{data}}/>

I'd be okay with this being forbidden for non-component elements and/or not allowed to mix with any other attributes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions