为什么 $firebaseArray 显示缓慢?

Why is $firebaseArray slow on display?

首先声明我是 firebase 的新手。因为我一直在玩 angularfire,我注意到 $firebaseArray 在我的项目中有点慢......

但是当我使用控制台查找何时 收到来自 firebase 的结果时,我意识到在该结果到达后在离子视图中显示之前还有一秒钟。

如果我说的不是很清楚,这里有一个 codepen 和 $firebaseArray

var lists = $firebaseArray(ref.child('lists'));

这是另一个 [codepen](抱歉不能添加超过两个链接),我在其中添加了这一行 after it

lists = [{"name":"test"}];

两个 codepen 中都有一个警报和控制台日志,显示数据何时到达。

我想问的是:为什么在数据已经到达之后为什么会有第二次延迟?

编辑:

因为 'slow' 没有任何意义,我为第一个 codepen 截取了浏览器网络的屏幕截图,显示显示数据需要多少时间: screenshot

虽然我在找到这个帖子时并不是真的在寻找它,但这里给出了我问题的答案:

Asynchronous access to an array in Firebase

By the time the browser executes your console.log(userTokens); the data most likely hasn't been loaded yet. So it just prints the object to the console as a placeholder.

By the time it gets to the for loop, the data may or may not yet have been loaded from Firebase.

At some point you clicked the arrow next to the logged userTokens. By that time the data had loaded from Firebase and the console shows the latest data.

所以无论如何,感谢您帮助回答我的问题:)