Simple Pagination With AngularJS and JSON using PHP

Simple Pagination With AngularJS and JSON using PHP

In this Post We Will Explain About is Simple Pagination With AngularJS and JSON using PHP With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to angularjs – Client side pagination using angular js Example

In this post we will show you Best way to implement Implementing pagination using AngularJS, hear for Pagination, Searching and Sorting of Data Table using AngularJS with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

READ :  C# Shortest Superstring Problem Algorithms

how to implement pagination in angularjs

In this Example,First of all Add or Inluce External Libs Like as a(jQuery, css etc..), and then create a simple index.php or index.html page.After that crate a simple javascript file like as a index.js or main.js, It is also add your web-application First Header Part to some priorty set.After that Include your relavant CSS Class.

Angular js simple providing a very easystep by step way to do simple client side pagination using angular script.Here We are going to some explain about step by step simple web-app’s client side pagination using simple first angular

Example of Controller

In controller we are some value assigning the json data to get all the datalist

READ :  Set textarea directive value in Angular

[php]
var app=angular.module(‘liveApp’, []);

app.controller(‘livepageCtrl’, function($scope, dataFactory) {
//Client-side simple pagination example
$scope.activePage = 0;
$scope.pagesTotalize = 10;
$scope.pagesTotal = 0;
$scope.livePageData = [];

$scope.btnDisabledpage = function(dir) {
if (dir == -1) {
return $scope.activePage == 0;
}
return $scope.activePage >= dataFactory.data.length/$scope.pagesTotalize – 1;
}

$scope.paginate = function(npmdata) {
$scope.activePage += (npmdata * 1);
$scope.livePageData = dataFactory.data.slice($scope.activePage*$scope.pagesTotalize);
}

function init() {
$scope.pagesTotal = Math.ceil(dataFactory.data.length/$scope.pagesTotalize);
$scope.livePageData = dataFactory.data;
}

init();

});

app.factory(‘dataFactory’, function() {
var factory = {};
factory.data = [];

//Fill with some defult fake data
function init() {
for (var i=0; i<92; i++) {
factory.data.push("students "+i);
}
}

init();

return factory;
});
[/php]

index.html

[php]

  • {{students}}

  

Page {{activePage+1}} of {{pagesTotal}}

[/php]

We can modify the CSS style for better look and some feel

READ :  Laravel 5.8 Get Last Inserted ID

You are Most welcome in my youtube Channel Please shubscibe my channel. and give me feedBackMore Details……
Angularjs Example

Example

I hope you have Got What is Pagination with Spring REST and AngularJS Table And how it works.I would Like to have FeaeBack From My Blog(infinityknow.com) readers.Your Valuable FeedBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.

Leave a Comment