Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Computed value in DS.Model returns Promise instead of Value #1315

aaronz8 opened this Issue · 2 comments

2 participants


more specific details here:

I'm trying to show a computed value in my template, but since the computed value uses an async linked model, it returns a promise. Is there any way to get or set the value when the promise is fulfilled?


You can try something like this:

App.Survey = DS.Model.extend({
  title: DS.attr(),
  owner: DS.belongsTo('user'),
  questions: DS.hasMany({ async:true }),

  totalResponses: Ember.arrayComputed('questions', {
    initialValue: 0,
    addedItem: function(accum, item) {
      accum += item.get('totalResponses');
    removedItem: function(accum, item) {
      accum -= item.get('totalResponses');

When questions resolves, the addedItem callback in totalResponses will be called once for every item in the resolved array.

@wycats wycats closed this

thanks! I'll try that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.