[英]How do I get a Scope for the first element of an array
I'm using AngularJS and Firebase and I have the below which is fine 我正在使用AngularJS和Firebase,下面有一个很好的
var myTeam = Teams.child(thisTeam);
var myFixtures = myTeam.child("fixtures").startAt(now).orderByChild("date");
$scope.team = $firebaseArray(myTeam);
$scope.fixtures = $firebaseArray(myFixtures);
Now I want to get the first fixture coming up and everything seems to point at being able to get it with 现在我想得到第一个固定装置,似乎一切都指向能够使用它
var myNextFixture = myFixtures.limitToFirst(1);
and then
$scope.fixtures = $firebaseArray(myFixtures);
but that doesn't return anything, what am I missing? 但这不返回任何东西,我想念什么?
The line var myNextFixture = myFixtures.limitToFirst(1); 行var myNextFixture = myFixtures.limitToFirst(1);
sets myNextFixture to undefined, I don't understand why. 将myNextFixture设置为undefined,我不明白为什么。 Iwould have thought it would have set myNextFixture to the first fixture in myFixtures but it doesn't
我本以为可以将myNextFixture设置为myFixtures中的第一个灯具,但是没有
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.