samedi 27 février 2016

How to extract a "ComputedProperty" to it's real value?

I'm trying to implement amCharts into a project, and it looks like when I pass it the EmberData model as it's dataProvider, it can't understand the promises.

I've tried to fix this by creating a computed property in my controller that looks like:

dataProvider: computed('users', function () {
    return get(this, 'users')
        .map(function (user) {
            return {
                calls_out:    user.calls_out,
                calls_in:     user.calls_in,
            }
        });
}),

However, when I log this I get the following:

0: Object +
    calls_in: ComputedProperty
    calls_out: ComputedProperty
    __proto__: Object
1: Object
2: Object

which means the object that amCharts needs to work with is still not the raw data. Is there a way to extract the data out into numbers rather than a Promise or a ComputedProperty?

Thanks!




Aucun commentaire:

Enregistrer un commentaire