Last active
February 21, 2024 11:53
-
-
Save shawndumas/31d50d88b63df58ac498 to your computer and use it in GitHub Desktop.
EmberJS -- bind attributes beginning with 'data-'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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