Ember Use findBy on PromiseArray

How to do a findBy on an PromiseArray in Ember?

export default Ember.ObjectController.extend({

  products: function() {
    return this.store.find('products');
  }.property(),

  product: function() {
    return this.get('products').findBy('default', true);
  }.property('products.isFulfilled')

});

The trick is to use the isFulfilled flag so it does not throw an error.

Ember < 2.0.0 (don’t now the exact version)

Happy coding! – Found a mistake or a typo? Please submit a PR to my GitHub-repo.

Like this post? Follow @adriaandotcom on X