Hello,
happy new year!
I’m trying to access a components property from its template. Howevever {{debugger}} doesn’t even list the property.
component.js:
import Ember from 'ember';
export default Ember.Component.extend({
values: {},
indexQty: Ember.computed('indexes', function() {
return this.get('indexes').length;
}),
setup: function() {
var indexQty = this.get('indexQty');
var _self = this;
setInterval(function() {
var values = {};
for (var i = 0; i < indexQty; i++) {
values[i] = Math.random();
}
_self.set('values', values);
},500);
}.on('didInsertElement'),
});
template.hbs:
{{#each indexes as |index delta|}}
<div class="bs-qty-{{indexQty}} bs-element-{{delta}} ">
<span class="value">{{get values delta}}</span><span class="unit">{{unit}}</span>
</div>
{{/each}}
while {{get values delta}} is empty and ‘values’ not visible when inspecting with {{debugger}}.
DEBUG: -------------------------------
DEBUG: Ember : 2.2.0
DEBUG: Ember Data : 2.2.1
DEBUG: jQuery : 1.11.3
DEBUG: -------------------------------
Any ideas?