How to create infinite scroll in angularjs










0














I have an array of response that came from the server with pagination. I want whenever a user scrolls down for more result the next page data should be loaded. Until user did not scroll down the data came from only page 1 and when user scroll down the page should be changed as 2,3,4,.. so on.
can anyone help me to create infinite scroll in angularjs.










share|improve this question




























    0














    I have an array of response that came from the server with pagination. I want whenever a user scrolls down for more result the next page data should be loaded. Until user did not scroll down the data came from only page 1 and when user scroll down the page should be changed as 2,3,4,.. so on.
    can anyone help me to create infinite scroll in angularjs.










    share|improve this question


























      0












      0








      0







      I have an array of response that came from the server with pagination. I want whenever a user scrolls down for more result the next page data should be loaded. Until user did not scroll down the data came from only page 1 and when user scroll down the page should be changed as 2,3,4,.. so on.
      can anyone help me to create infinite scroll in angularjs.










      share|improve this question















      I have an array of response that came from the server with pagination. I want whenever a user scrolls down for more result the next page data should be loaded. Until user did not scroll down the data came from only page 1 and when user scroll down the page should be changed as 2,3,4,.. so on.
      can anyone help me to create infinite scroll in angularjs.







      angularjs scroll






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 7:40









      Mukyuu

      6721519




      6721519










      asked Nov 13 '18 at 1:57









      user10428712

      136




      136






















          2 Answers
          2






          active

          oldest

          votes


















          1














          You can refer my sample, what I apply for table



          Html code :



          <div ng-controller="appController">

          <h1>This is my title Items: numberToDisplay/totalDisplay</h1>
          <div class="constrained">
          <table class="table table-striped" id="loggingTable" infinite-scroll="loadMore()" infinite-scroll-container='".constrained"' infinite-scroll-distance="1" infinite-scroll-parent="true">
          <tr data-ng-show="logEventFilter.length === 0">
          <td class="center" colspan="3">Nobody is here</td>
          </tr>

          <tr data-ng-repeat="logEvent in logEventFilter = (logEvents | limitTo:numberToDisplay) track by $index">
          <td> $index </td>
          <td> logEvent.name </td>
          <td> numberToDisplay </td>
          </tr>
          </table>
          </div>

          </div>


          Angularjs code :



           var app = angular.module('app', ['infinite-scroll'])
          .controller('appController', appController);

          appController.$inject = ['$scope', '$window'];

          function appController($scope, $window)

          $scope.title = "infinite scroll example";
          $scope.numberToDisplay = 20;
          $scope.totalDisplay = 500;
          $scope.logEvents = ;
          for (var i = 0; i < $scope.totalDisplay; i++)
          $scope.logEvents.push(
          name: "Hello, my name is " + i
          );


          $scope.loadMore = function()
          if ($scope.numberToDisplay + 5 < $scope.logEvents.length)
          $scope.numberToDisplay += 5;
          else
          $scope.numberToDisplay = $scope.logEvents.length;

          ;
          ;


          sample scroll infinite






          share|improve this answer




















          • Thanks @thanhdung0312 for the help
            – user10428712
            Nov 15 '18 at 9:09










          • you're welcome @user10428712
            – thanhdung0312
            Nov 15 '18 at 9:10


















          0














          you can you angular ui scroll



          This helps in loading the data as and when the user scrolls down.






          share|improve this answer




















          • As I told I have multiple page data in different page number, when scroll to bottom then one by one each page number (API) is getting hit. How can I achieve this in angular ui scroll?
            – user10428712
            Nov 13 '18 at 9:14










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53272686%2fhow-to-create-infinite-scroll-in-angularjs%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          You can refer my sample, what I apply for table



          Html code :



          <div ng-controller="appController">

          <h1>This is my title Items: numberToDisplay/totalDisplay</h1>
          <div class="constrained">
          <table class="table table-striped" id="loggingTable" infinite-scroll="loadMore()" infinite-scroll-container='".constrained"' infinite-scroll-distance="1" infinite-scroll-parent="true">
          <tr data-ng-show="logEventFilter.length === 0">
          <td class="center" colspan="3">Nobody is here</td>
          </tr>

          <tr data-ng-repeat="logEvent in logEventFilter = (logEvents | limitTo:numberToDisplay) track by $index">
          <td> $index </td>
          <td> logEvent.name </td>
          <td> numberToDisplay </td>
          </tr>
          </table>
          </div>

          </div>


          Angularjs code :



           var app = angular.module('app', ['infinite-scroll'])
          .controller('appController', appController);

          appController.$inject = ['$scope', '$window'];

          function appController($scope, $window)

          $scope.title = "infinite scroll example";
          $scope.numberToDisplay = 20;
          $scope.totalDisplay = 500;
          $scope.logEvents = ;
          for (var i = 0; i < $scope.totalDisplay; i++)
          $scope.logEvents.push(
          name: "Hello, my name is " + i
          );


          $scope.loadMore = function()
          if ($scope.numberToDisplay + 5 < $scope.logEvents.length)
          $scope.numberToDisplay += 5;
          else
          $scope.numberToDisplay = $scope.logEvents.length;

          ;
          ;


          sample scroll infinite






          share|improve this answer




















          • Thanks @thanhdung0312 for the help
            – user10428712
            Nov 15 '18 at 9:09










          • you're welcome @user10428712
            – thanhdung0312
            Nov 15 '18 at 9:10















          1














          You can refer my sample, what I apply for table



          Html code :



          <div ng-controller="appController">

          <h1>This is my title Items: numberToDisplay/totalDisplay</h1>
          <div class="constrained">
          <table class="table table-striped" id="loggingTable" infinite-scroll="loadMore()" infinite-scroll-container='".constrained"' infinite-scroll-distance="1" infinite-scroll-parent="true">
          <tr data-ng-show="logEventFilter.length === 0">
          <td class="center" colspan="3">Nobody is here</td>
          </tr>

          <tr data-ng-repeat="logEvent in logEventFilter = (logEvents | limitTo:numberToDisplay) track by $index">
          <td> $index </td>
          <td> logEvent.name </td>
          <td> numberToDisplay </td>
          </tr>
          </table>
          </div>

          </div>


          Angularjs code :



           var app = angular.module('app', ['infinite-scroll'])
          .controller('appController', appController);

          appController.$inject = ['$scope', '$window'];

          function appController($scope, $window)

          $scope.title = "infinite scroll example";
          $scope.numberToDisplay = 20;
          $scope.totalDisplay = 500;
          $scope.logEvents = ;
          for (var i = 0; i < $scope.totalDisplay; i++)
          $scope.logEvents.push(
          name: "Hello, my name is " + i
          );


          $scope.loadMore = function()
          if ($scope.numberToDisplay + 5 < $scope.logEvents.length)
          $scope.numberToDisplay += 5;
          else
          $scope.numberToDisplay = $scope.logEvents.length;

          ;
          ;


          sample scroll infinite






          share|improve this answer




















          • Thanks @thanhdung0312 for the help
            – user10428712
            Nov 15 '18 at 9:09










          • you're welcome @user10428712
            – thanhdung0312
            Nov 15 '18 at 9:10













          1












          1








          1






          You can refer my sample, what I apply for table



          Html code :



          <div ng-controller="appController">

          <h1>This is my title Items: numberToDisplay/totalDisplay</h1>
          <div class="constrained">
          <table class="table table-striped" id="loggingTable" infinite-scroll="loadMore()" infinite-scroll-container='".constrained"' infinite-scroll-distance="1" infinite-scroll-parent="true">
          <tr data-ng-show="logEventFilter.length === 0">
          <td class="center" colspan="3">Nobody is here</td>
          </tr>

          <tr data-ng-repeat="logEvent in logEventFilter = (logEvents | limitTo:numberToDisplay) track by $index">
          <td> $index </td>
          <td> logEvent.name </td>
          <td> numberToDisplay </td>
          </tr>
          </table>
          </div>

          </div>


          Angularjs code :



           var app = angular.module('app', ['infinite-scroll'])
          .controller('appController', appController);

          appController.$inject = ['$scope', '$window'];

          function appController($scope, $window)

          $scope.title = "infinite scroll example";
          $scope.numberToDisplay = 20;
          $scope.totalDisplay = 500;
          $scope.logEvents = ;
          for (var i = 0; i < $scope.totalDisplay; i++)
          $scope.logEvents.push(
          name: "Hello, my name is " + i
          );


          $scope.loadMore = function()
          if ($scope.numberToDisplay + 5 < $scope.logEvents.length)
          $scope.numberToDisplay += 5;
          else
          $scope.numberToDisplay = $scope.logEvents.length;

          ;
          ;


          sample scroll infinite






          share|improve this answer












          You can refer my sample, what I apply for table



          Html code :



          <div ng-controller="appController">

          <h1>This is my title Items: numberToDisplay/totalDisplay</h1>
          <div class="constrained">
          <table class="table table-striped" id="loggingTable" infinite-scroll="loadMore()" infinite-scroll-container='".constrained"' infinite-scroll-distance="1" infinite-scroll-parent="true">
          <tr data-ng-show="logEventFilter.length === 0">
          <td class="center" colspan="3">Nobody is here</td>
          </tr>

          <tr data-ng-repeat="logEvent in logEventFilter = (logEvents | limitTo:numberToDisplay) track by $index">
          <td> $index </td>
          <td> logEvent.name </td>
          <td> numberToDisplay </td>
          </tr>
          </table>
          </div>

          </div>


          Angularjs code :



           var app = angular.module('app', ['infinite-scroll'])
          .controller('appController', appController);

          appController.$inject = ['$scope', '$window'];

          function appController($scope, $window)

          $scope.title = "infinite scroll example";
          $scope.numberToDisplay = 20;
          $scope.totalDisplay = 500;
          $scope.logEvents = ;
          for (var i = 0; i < $scope.totalDisplay; i++)
          $scope.logEvents.push(
          name: "Hello, my name is " + i
          );


          $scope.loadMore = function()
          if ($scope.numberToDisplay + 5 < $scope.logEvents.length)
          $scope.numberToDisplay += 5;
          else
          $scope.numberToDisplay = $scope.logEvents.length;

          ;
          ;


          sample scroll infinite







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 15 '18 at 8:43









          thanhdung0312

          1867




          1867











          • Thanks @thanhdung0312 for the help
            – user10428712
            Nov 15 '18 at 9:09










          • you're welcome @user10428712
            – thanhdung0312
            Nov 15 '18 at 9:10
















          • Thanks @thanhdung0312 for the help
            – user10428712
            Nov 15 '18 at 9:09










          • you're welcome @user10428712
            – thanhdung0312
            Nov 15 '18 at 9:10















          Thanks @thanhdung0312 for the help
          – user10428712
          Nov 15 '18 at 9:09




          Thanks @thanhdung0312 for the help
          – user10428712
          Nov 15 '18 at 9:09












          you're welcome @user10428712
          – thanhdung0312
          Nov 15 '18 at 9:10




          you're welcome @user10428712
          – thanhdung0312
          Nov 15 '18 at 9:10













          0














          you can you angular ui scroll



          This helps in loading the data as and when the user scrolls down.






          share|improve this answer




















          • As I told I have multiple page data in different page number, when scroll to bottom then one by one each page number (API) is getting hit. How can I achieve this in angular ui scroll?
            – user10428712
            Nov 13 '18 at 9:14















          0














          you can you angular ui scroll



          This helps in loading the data as and when the user scrolls down.






          share|improve this answer




















          • As I told I have multiple page data in different page number, when scroll to bottom then one by one each page number (API) is getting hit. How can I achieve this in angular ui scroll?
            – user10428712
            Nov 13 '18 at 9:14













          0












          0








          0






          you can you angular ui scroll



          This helps in loading the data as and when the user scrolls down.






          share|improve this answer












          you can you angular ui scroll



          This helps in loading the data as and when the user scrolls down.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 '18 at 8:41









          Anjana G

          843




          843











          • As I told I have multiple page data in different page number, when scroll to bottom then one by one each page number (API) is getting hit. How can I achieve this in angular ui scroll?
            – user10428712
            Nov 13 '18 at 9:14
















          • As I told I have multiple page data in different page number, when scroll to bottom then one by one each page number (API) is getting hit. How can I achieve this in angular ui scroll?
            – user10428712
            Nov 13 '18 at 9:14















          As I told I have multiple page data in different page number, when scroll to bottom then one by one each page number (API) is getting hit. How can I achieve this in angular ui scroll?
          – user10428712
          Nov 13 '18 at 9:14




          As I told I have multiple page data in different page number, when scroll to bottom then one by one each page number (API) is getting hit. How can I achieve this in angular ui scroll?
          – user10428712
          Nov 13 '18 at 9:14

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53272686%2fhow-to-create-infinite-scroll-in-angularjs%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Top Tejano songwriter Luis Silva dead of heart attack at 64

          ReactJS Fetched API data displays live - need Data displayed static

          政党