How to create infinite scroll in angularjs
up vote
0
down vote
favorite
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
add a comment |
up vote
0
down vote
favorite
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
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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
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
angularjs scroll
edited Nov 13 at 7:40
Mukyuu
3191216
3191216
asked Nov 13 at 1:57
user10428712
96
96
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
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
Thanks @thanhdung0312 for the help
– user10428712
Nov 15 at 9:09
you're welcome @user10428712
– thanhdung0312
Nov 15 at 9:10
add a comment |
up vote
0
down vote
you can you angular ui scroll
This helps in loading the data as and when the user scrolls down.
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 at 9:14
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
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
Thanks @thanhdung0312 for the help
– user10428712
Nov 15 at 9:09
you're welcome @user10428712
– thanhdung0312
Nov 15 at 9:10
add a comment |
up vote
1
down vote
accepted
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
Thanks @thanhdung0312 for the help
– user10428712
Nov 15 at 9:09
you're welcome @user10428712
– thanhdung0312
Nov 15 at 9:10
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
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
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
answered Nov 15 at 8:43
thanhdung0312
1667
1667
Thanks @thanhdung0312 for the help
– user10428712
Nov 15 at 9:09
you're welcome @user10428712
– thanhdung0312
Nov 15 at 9:10
add a comment |
Thanks @thanhdung0312 for the help
– user10428712
Nov 15 at 9:09
you're welcome @user10428712
– thanhdung0312
Nov 15 at 9:10
Thanks @thanhdung0312 for the help
– user10428712
Nov 15 at 9:09
Thanks @thanhdung0312 for the help
– user10428712
Nov 15 at 9:09
you're welcome @user10428712
– thanhdung0312
Nov 15 at 9:10
you're welcome @user10428712
– thanhdung0312
Nov 15 at 9:10
add a comment |
up vote
0
down vote
you can you angular ui scroll
This helps in loading the data as and when the user scrolls down.
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 at 9:14
add a comment |
up vote
0
down vote
you can you angular ui scroll
This helps in loading the data as and when the user scrolls down.
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 at 9:14
add a comment |
up vote
0
down vote
up vote
0
down vote
you can you angular ui scroll
This helps in loading the data as and when the user scrolls down.
you can you angular ui scroll
This helps in loading the data as and when the user scrolls down.
answered Nov 13 at 8:41
Anjana G
842
842
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 at 9:14
add a comment |
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 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 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 at 9:14
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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