mardi 24 novembre 2015

attributeBindings and classBindings not appending to with component helper in Ember 2.1?

I have a widget dashboard app where the individual widgets are displayed using the component helper. A template ends up looking like this:

<div class="panel panel-default">
  <div class="panel-body">
    {{component model.displayComponent model=model}}
  </div>
</div>

A Widget instance will return a path for the displayComponent like: widgets/category/specific-widget.

What I'm finding, in Ember 2.1, is that the attributeBindings and classBindings defined on the component are not being applied. And I think they were being applied back in Ember 1.13.

In other words, in 1.13 think a component defined like this:

// app/components/widgets/category/specific-widget.js
export default Ember.Component.extend({
  model:      null,
  classNames: [ 'widget-content' ],
  attributeBindings: [ 'style:style' ],
  style:      Ember.computed.readOnly('model.contentHeight')
});

I would get a <div id="ember..." style="height:300px" class="ember-view widget-content">...</div>. Now I simply get the default <div id="ember..." class="ember-view">...</div>.

Am I mistaken about the old behavior? If not, is there a way to make this work the old way?

P.S. I'm unable to find the documentation for the component helper anywhere. Is that on the ember.js site?




Aucun commentaire:

Enregistrer un commentaire