0

I wrote this code after reading multiple posts about ng-infinite-scroll

<div class="course-enrollment-friends" ng-class="{'friends-paginated':showMoreFriends}">
    <div class="row" id="enrollment-friends" ng-show="!noFriends">
        <div
         infinite-scroll="enrollCtrl.retYearAndSem()"
         infinite-scroll-disabled='!{{showMoreFriends}}'
         infinite-scroll-parent='true'>
            <div class="col-md-2" ng-repeat="friend in friends" style="margin-bottom:10px;">

However this didn't work. So I tried something slightly different

<div class="course-enrollment-friends" ng-class="{'friends-paginated':showMoreFriends}">
    <div class="row" id="enrollment-friends" ng-show="!noFriends">
        <div
         infinite-scroll="enrollCtrl.retYearAndSem()"
         infinite-scroll-disabled='!{{showMoreFriends}}'
         infinite-scroll-container='.course-enrollment-friends'>
            <div class="col-md-2" ng-repeat="friend in friends" style="margin-bottom:10px;">

What am I doing wrong?

Ysrninja
  • 59
  • 2
  • 9

2 Answers2

0

From the answer in this thread, it seems you forgot the double quotes:

The value of infinite-scroll-container in this example is double-quoted class name .content then wrapped by single quotes. If you read the source, the string value eventually gets fed into document.querySelector. You can read the documentation on that to see what value it expects.

Without the double quotes .course-enrollment-friends is passed in as a variable name, not as a string as is required.

So

infinite-scroll-container='".course-enrollment-friends"'

instead of

infinite-scroll-container='.course-enrollment-friends'
Community
  • 1
  • 1
Jon G Stødle
  • 3,666
  • 1
  • 15
  • 22
  • Hey, thanks for the reply. While I was hopeful that you caught the issue, it still didn't work... I'm guessing I'm doing something wrong with the divs somewhere – Ysrninja Jul 14 '15 at 08:05
0

Try removing the braces around the value given in infinite-scroll-disabled. Use:

<div
     infinite-scroll="enrollCtrl.retYearAndSem()"
     infinite-scroll-disabled='!showMoreFriends'
     infinite-scroll-container='.course-enrollment-friends'>

instead of :

<div
     infinite-scroll="enrollCtrl.retYearAndSem()"
     infinite-scroll-disabled='!{{showMoreFriends}}'
     infinite-scroll-container='.course-enrollment-friends'>