Hi , am implementing a comment feature ,on my app
am using firebase as the backend ,i can seem to able to orderby a key
.factory("items", function($firebaseArray) {
var itemsRef = new Firebase("https//buzzgh.firebaseio.com/comments");
return itemRef ;
})
.controller('tdCtrl', function($scope, FeedList,$firebaseArray, $stateParams, dataStore, feedSources, $ionicModal, items) {
$scope.feeds = FeedList.get(feedSources.top, dataStore.topfeeds);
$scope.feed = $stateParams.feed;
$scope.item = $stateParams.item;
$scope.items=$firebaseArray(items);
var id=parseInt($scope.feeds[$scope.feed].$$hashKey.slice(7) + $scope.feeds[$scope.feed].entries[$scope.item].$$hashKey.slice(7));
$scope.items = items.orderByChild("hashKey").equalTo(parseInt($scope.feeds[$scope.feed].$$hashKey.slice(7) +
$scope.feeds[$scope.feed].entries[$scope.item].$$hashKey.slice(7))).on("child_added", function(snapshot) {
});
this is how am doing posting
$scope.postComment = function() {
$scope.itemsadd=$firebaseArray(items);
$scope.comment.username = "wasiu";
$scope.comment.hashKey=parseInt($scope.feeds[$scope.feed].$$hashKey.slice(7) + $scope.feeds[$scope.feed].entries[$scope.item].$$hashKey.slice(7));
$scope.itemsadd.$add($scope.comment);
// console.log($scope.feeds[$scope.feed].$$hashKey.slice(7) + $scope.feeds[$scope.feed].entries[$scope.item].$$hashKey.slice(7));
$scope.comment = {};
$scope.closeComment();
};
but this logic does not work even thought posting to firebase works
what am really trying to achieve is to hav a comment section which isolate and return specific data using hashkey