У меня есть компонент:получить от модели, а затем установить новое свойство на нем
App.MyChildComponent = Ember.Component.extend({
addTooltips: Ember.on('didInsertElement', function() {
var me = this;
var metrics = this.get('option.metrics');
metrics.forEach(function(e, i) {
me.get('option.metrics').objectAt(i - 1).set('tooltipDisabled', true);
});
});
})
, который генерируется внутри каждого цикла с помощью различных компонентов:
App.MyParentComponent = Ember.Component.extend({
...
})
И шаблоне MyParentComponent является:
{{#each option in options}}
{{my-child option=option}}
{{/each}}
Все это, вызывается тем с шаблоном, как это:
{{my-parent options=options}}
опции определяется в модели представления с:
App.MyViewModel = Ember.Object.extend({
options: Ember.A([
{ metrics: Ember.A([
{ name: 'a' },
{ name: 'b' },
{ name: 'c' }
]) },
{ metrics: Ember.A([
{ name: 'd' },
{ name: 'e' },
{ name: 'f' }
]) },
{ metrics: Ember.A([
{ name: 'g' },
{ name: 'h' },
{ name: 'i' }
]) }
]),
});
Когда я бегу me.get('option.metrics').objectAt(i - 1).set('tooltipDisabled', true);
я получаю:
Uncaught TypeError: me.get(...).objectAt(...).set is not a function
Что я делаю неправильно?