Reputation: 931
I want to set the draggable
attribute to the component div
itself.
In previous versions of ember (pre 1.13) I am used to use the attributeBindings
property. But since 1.13 this property seems to be deprecated.
There are new lifecyle hooks for components (http://emberjs.com/blog/2015/06/12/ember-1-13-0-released.html#toc_component-lifecycle-hooks) but that didnt helped me either.
didInitAttrs() {
this.set('draggable', true);
}
What is the prefered way to achieve this behavior?
UPDATE
In the meantime this is my solution:
import Ember from 'ember';
export default Ember.Component.extend({
draggable: true,
willInsertElement() {
this.set('element.draggable', this.get('draggable'));
}
});
Upvotes: 0
Views: 751
Reputation: 37065
AttributeBindings
are not deprecated or you would get warnings when using them with components.
The property just happens to be inherited from ember views which are going away in 2.4 (long time away), but it doesn't mean the inherited interfaces on the components will go away without any deprecation notice. So just keep using attributeBindings
.
Upvotes: 1