次のデータを持つ投稿を保存するためにfirebaseを使用しています:
createdAt: "Sun Apr 03 2016 18:32:46 GMT-0300 (BRT)"
私が達成しようとしているのは、最初に最新の投稿を取得してから、ユーザーが下にスクロールしている間に古い投稿をロードすることです。
ngInfiniteScroll を使用して取得した投稿では、desc を使用して注文できます<div ng-repeat="post in posts | orderBy:'-createdAt'">
が、ngInfiniteScroll は古い投稿を最初に返し続けます。注文していますが、古いものを注文しています。
"-createdAt"
ngInfiniteScroll で同じロジック ( ) を使用しようとしましたが、効果がありませんでした。
私のjsはほとんどこれです:
var baseRef = new Firebase(FBURL).child("posts");
var scrollRef = new Firebase.util.Scroll(baseRef, "createdAt");
$scope.posts = $firebaseArray(scrollRef);
$scope.posts.scroll = scrollRef.scroll;
セキュリティとルール:
"posts": {
".read": true,
".indexOn": "createdAt",
"$post": {
".read": true,
".write": true,
"$other": {
".validate": true
}
}
}