Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug Ember data's find in the console

With this post, I learned that I can use find in the console. But I'm having some problems using this to look up the data in my litte jsbin Ember.js with Ember Data and LSAdapter App here.

  1. Please add some orgs
  2. Please open your chrome console to see more details.
  3. Please type in App.container.lookup('store:main').find('org').toArray() Why does it show an empty array???

Thank you so much for helping out

like image 857
HaoQi Li Avatar asked Sep 11 '13 22:09

HaoQi Li


1 Answers

It's because find returns promises now

App.__container__.lookup('store:main').find('org').then(function(stuff){console.log(stuff.toArray())});

You can see that find is a promise when you do

> App.__container__.lookup('store:main').find('org').toString();

"<DS.PromiseArray:ember355>"
like image 117
HaoQi Li Avatar answered Oct 04 '22 04:10

HaoQi Li