1

once a certain process is done I need to set a boolean to true in order to update the template.

I can easily get the object, but setting a property seems to be more difficult. What I use to get the object is

var found = self.get('content').findProperty('id', self.datasetid);

If I do that in the chrome console I can clearly see that I get an ember object back:

Object {id: 1, active: true}
__ember1364221685101_meta: Meta
active: true
get data_set: function () {
id: 1
set data_set: function (value) {
__proto__: Object

When I do:

found.set('data_set.fully_geocoded', true);

I do get the error mentioned in title. I've tried as many different flavours as I could think of, but all with the same result.

Could somebody shine a light on this?


An Object isn't an instance of Ember.Object, but the base Javascript class Object, so it won't have a get and set method.

You can get much of the same functionality by using Ember.get and Ember.set directly, passing in the object, as such:

Ember.set(found, 'data_set.fully_geocoded', true)
Ember.get(found, 'data_set.fully_geocoded')

Computed properties and observers can also fire based on using Ember.set this way.

4

1 に答える 1

2

AnObjectは Ember.Object のインスタンスではなく、Javascript の基本クラスであるため、 andメソッドObjectはありません。getset

Ember.get次のように、 and をEmber.set直接使用してオブジェクトを渡すことで、同じ機能の多くを取得できます。

Ember.set(found, 'data_set.fully_geocoded', true)
Ember.get(found, 'data_set.fully_geocoded')

Ember.set計算されたプロパティとオブザーバーも、この方法の使用に基づいて起動できます。

于 2013-03-25T16:19:28.477 に答える