This addon lets you easily bind 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 (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 attributes
helper will always win over attribute bindings that are defined on the class.
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.