How to debug Ember data's find in the console

孤街浪徒 提交于 2019-12-21 04:56:48

问题


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


回答1:


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>"


来源:https://stackoverflow.com/questions/18752160/how-to-debug-ember-datas-find-in-the-console

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!