Where to define custom attribute bindings?


#1

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?


#2

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?


#3

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


#4

Excellent, glad to help!


#5

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