Where to define custom attribute bindings?

I would like to enable support for a specific data-attribute on an input field as described here: Binding Element Attributes - Templates - Ember Guides

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: Remove `views` directory by default · Issue #4083 · ember-cli/ember-cli · GitHub).

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

1 Like

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.