Where to define custom attribute bindings?


I would like to enable support for a specific data-attribute on an input field as described here: http://guides.emberjs.com/v1.11.0/templates/binding-element-attributes/#toc_adding-data-attributes

Now I don’t know where (in which file / ember module) I have to put the code into. The project is set up with Ember v1.11.0 and EmberCLI v0.2.6 and this configuration says that “views” (where I thought it is the right place) become deprecated in Ember 2.0 (see: https://github.com/ember-cli/ember-cli/issues/4083).

The changes should apply all for the entire application and I don’t want to repeat the code at some point. Any suggestions?


The view replacement is component. You could have a mixin or base component if you need the same data bindings for all your components. Is that what you mean?


That’s exactly the information what I was looking for, thank you for your answer!


Excellent, glad to help!


Another option is to reopen Ember.Component within an initializer. You don’t have to inherit from a custom component class that way.