0

Am using firebase.util to create infiniteScroll. I downloaded firebase util using bower.Then i try this code:

In my HTML file :

<div class="list">
<div ng-repeat="e in events "  class="item" >
<div class="list" >
 <a class="item item-thumbnail-left" ui-sref='eventDetail({eventId:e.$id})'>
  <img src="img/ionic.png">
   <h2>{{e.name}}</h2>
   <h2>Categerie: {{e.categorie.label}}</h2>
 </a>
</div>
</div>

<ion-infinite-scroll ng-if="!noMoreItemsAvailable" on-infinite="loadMore()" distance="10%"></ion-infinite-scroll>

In my controller:

var baseRef = new Firebase('https://event-application.firebaseio.com/event');  
var scrollRef = new Firebase.util.Scroll(baseRef, 'name');
$scope.events = $firebaseArray(scrollRef);
scrollRef.scroll.next(3);
$scope.loadMore = function() {
  scrollRef.scroll.next(2);
  $scope.$broadcast('scroll.infiniteScrollComplete');
};

Any help is appreciated.

Frank van Puffelen
  • 418,229
  • 62
  • 649
  • 645
Sihem Hcine
  • 1,011
  • 3
  • 22
  • 37
  • Try outputting scrollRef, check if its defined. – softvar Apr 20 '16 at 19:31
  • I can't outpout scrollRef because the error is mentioned in this line ` var scrollRef = new Firebase.util.Scroll(baseRef, 'name');` . I would ask if i must put firebase-util as injection in the model ? – Sihem Hcine Apr 21 '16 at 10:26
  • Check in if `Firebase` is defined in the controller. – softvar Apr 21 '16 at 21:44
  • yes it's defined . – Sihem Hcine Apr 21 '16 at 22:24
  • And what about `Firebase.util`, what does it print in console? I think `util` method is missing on Firebase somehow – softvar Apr 23 '16 at 10:49
  • i installed firebase util using bower but i don't find how to inject it in my module. Normally i must inject it ? – Sihem Hcine Apr 23 '16 at 10:55
  • I face the same problem when try this code [link]( https://gist.github.com/katowulf/7adb5775dce44cbbba0a) . Any help please. – Sihem Hcine Apr 24 '16 at 17:45
  • 1
    If you installed it an angular module, then yes, inject it as a service. If it's just a library then you can require it(if using requirejs) or simply in your HTMl using script tag. – softvar Apr 24 '16 at 18:48

0 Answers0