This addon lets you easily bind HTML attributes to your ember components. It was inspired by the discussion in this rfc.
ember install ember-component-attributes
To bind an attribute foo
to the value of bar
, pass (html-attributes foo=bar)
as the last positional argument to your component:
This helper also works with class
and id
attributes if you prefer to keep all your attributes together.
Attribute bindings defined with the html-attributes
helper will always win over attribute bindings that are defined on the class.
This addon is guaranteed to work with Ember 2.8 and up. It may work with older versions as well although the earliest working version is unknown.
This addon is implemented with a naive Glimmer AST transform so you can't do fancy things like
If this feature is accepted into the Ember core then we will consider removing this limitation.