如何在控制台中调试Ember数据的查找 [英] How to debug Ember data's find in the console

查看:105
本文介绍了如何在控制台中调试Ember数据的查找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此帖,我了解到我可以使用 find 在控制台。但是,使用这种方式查找我的 litte jsbin Ember.js与Ember Data和LSAdapter的数据有一些问题请在这里


  1. 请添加一些组织

  2. 请打开Chrome控制台请查看更多详情。

  3. 请输入 App。 container .lookup('store:main')find('org' .toArray() 为什么它显示一个空数组

非常感谢您的帮助

解决方案

这是因为现在找到退货承诺


$ b $然后(function(stuff){console.log(stuff.toArray()),然后(...) });

你可以看到find是一个承诺,当你做

 >应用.__ __集装箱查找(店:主)找到(组织)的toString();。 

< DS.PromiseArray:ember355>


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

解决方案

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

这篇关于如何在控制台中调试Ember数据的查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆