1

I'm currently having trouble accessing the data returned by my fixtures. They either return a promise or a hasMany array, however, even when using a .then function call I am unable to successfully retrieve data in my controller. Handlebars will render them and resolve them, but I cannot compute or modify them prior to render.

See my JSBin here: http://emberjs.jsbin.com/OyItix/10/edit

Can I convert them to an enumerable array?

For anyone else who find this:

var participants = this.get('group.participants'); // Get it from the store, returns a promise

participants.then(function(result) { 
    result.get('content').forEach( function(participant) {
        console.log(participant.get('name'));
    });
});

The return value for the property will initially be null, but will resolve.

4

1 回答 1

1

你不需要转换它们。

将参数添加到控制器(IndexController)中的property(),然后模型更新时将自动重新计算观察值。

属性() => 属性('group.participants')

http://emberjs.jsbin.com/axIyicu/1/edit

于 2013-10-26T12:38:42.510 回答