0

我在阅读了多篇关于 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;">

然而这并没有奏效。所以我尝试了一些稍微不同的东西

<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;">

我究竟做错了什么?

4

2 回答 2

0

尝试删除无限滚动禁用中给出的值周围的大括号。利用:

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

代替 :

<div
     infinite-scroll="enrollCtrl.retYearAndSem()"
     infinite-scroll-disabled='!{{showMoreFriends}}'
     infinite-scroll-container='.course-enrollment-friends'>
于 2016-05-15T04:29:47.877 回答
0

这个线程的答案中,您似乎忘记了双引号:

在这个例子中,infinite-scroll-container 的值是用双引号引起来的类名 .content 然后用单引号括起来。如果您阅读源代码,字符串值最终会输入到 document.querySelector。您可以阅读相关文档以查看它期望的值。

如果没有双引号.course-enrollment-friends,则作为变量名传入,而不是作为所需的字符串传入。

所以

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

代替

infinite-scroll-container='.course-enrollment-friends'
于 2015-07-14T07:59:31.530 回答