Skip to content

Instantly share code, notes, and snippets.

@shawndumas
Last active February 21, 2024 11:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawndumas/31d50d88b63df58ac498 to your computer and use it in GitHub Desktop.
Save shawndumas/31d50d88b63df58ac498 to your computer and use it in GitHub Desktop.
EmberJS -- bind attributes beginning with 'data-'
export default Ember.View.reopen({
init() {
this._super.apply(this, arguments);
// bind attributes beginning with 'data-'
Em.keys(this)
.filter(key => key.substr(0, 5) === 'data-')
.forEach(key => this.get('attributeBindings').pushObject(key));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment