Skip to content

A modifier to more easily handle attribute bindings for ember apps

License

Notifications You must be signed in to change notification settings

donaldwasserman/ember-attribute-modifier

Repository files navigation

ember-attribute-modifier

This attribute modifier is made for declarative attribute bindings for DOM nodes.

This addon is heavily "inspired" by ember-class-modifier.

Usage

When you want to conditionally apply a list of variable attributes onto an element, it's a pain (especially for data-test attributes).

  // component.js
  myAttributes = ['data-test-thing', 'data-test-other-thing']
  // also works like
  myAttributes = 'data-test-thing, data-test-other-thing'
  <button {{attribute this.myAttributes}}></button>

Conditionally remove attributes based on booleans

  // component.js
  isDisabled = false
  <div {{attribute data-test-disabled=this.isDisabled}}></div>

Compatibility

  • Ember.js v3.4 or above
  • Ember CLI v2.13 or above
  • Node.js v8 or above

Installation

ember install ember-attribute-modifier

Usage

[Longer description of how to use the addon in apps.]

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

About

A modifier to more easily handle attribute bindings for ember apps

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published