svileng / ng-simplepagination Goto Github PK
View Code? Open in Web Editor NEWDead simple pagination for AngularJS on static data.
License: MIT License
Dead simple pagination for AngularJS on static data.
License: MIT License
<div ng-repeat="data in datas track by data.id | startFrom: pagination.page * pagination.perPage | limitTo: pagination.perPage" class="col col-md-4 col-sm-4">
<-- stuff -->
</div>
Everything else is great. Thank you!
I would like you to consider the action of the burden of the last page in your source code for example:
paginator.toFinalPage = function () {
if (paginator.page! = null) {
paginator.numPages paginator.page = -1;
}
};
Thank you for your contribution was very helpful to me.
Just an idea: if you have many pages - this sometimes happens - and you want to limit the number of pages shown, something like below might be useful:
paginationModule.filter('limitPages', function() {
return function(input, paginator, total) {
total = parseInt(total);
var first = 0;
var last = Math.min(paginator.numPages, total);
if (total < paginator.numPages) {
var mid = total/2.0;
if (paginator.page > paginator.numPages - mid) {
last = paginator.numPages
first = paginator.numPages-total
} else {
if (paginator.page+1 - mid > 0) {
first = paginator.page - Math.floor(mid);
last = paginator.page + Math.ceil(mid);
}
}
}
for (var i = first; i < last; i++) {
input.push(i);
}
return input;
};
});
This can be used like ng-repeat = "n in [] | limitpages:pag:7"
In your Readme.md you tell to use ng-hide... This is not nice to the DOM!
My ng-if implementation of your module... (foundation 5 css)
<div class="row">
<div class="large-12 small-12 columns">
<ul class="pagination">
<li ng-if="pagination.page != 0">
<a href="#" ng-click="pagination.prevPage()">‹</a>
</li>
<li ng-repeat="n in [] | range: pagination.numPages">
<a href="#" ng-click="pagination.toPageId(n)">{{n + 1}}</a>
</li>
<li ng-if="pagination.page < (pagination.numPages - 1)">
<a href="#" ng-click="pagination.nextPage()">›</a>
</li>
</ul>
</div>
</div>
Trying to add this component to rails-assets.org
Getting this error:
"ng-simplePagination has no versions defined. Please create an issue in component's repository."
As far as I can determine, the module works as expected, but:
TypeError: Cannot call method 'slice' of undefined
at Object. (http://dev.local:3000/javascripts/simplePagination.js:45:17)
at fnInvoke
is logged in the console four times. Line 45 corresponds to:
paginationModule.filter('startFrom', function() {
return function(input, start) {
return input.slice(+start);
}
});
The pagination is not updating when data is filtered.
Is there any possibility to make it update according to the filtered items.
Thank you.
Please check the fiddle here: http://jsfiddle.net/gxt4nek9/
Hi,
When you go back via the browser button after a simplePaginated list it doesn't remember the page you were. Is there a way to remember the page you were?
Like: list with 3 pages, clicked on second page, click item, go back in browser, open list on page 2.
Hi,
It might be a simple question but I am not sure if Is possible to add a (...) in the middle of the page numbers? I want to avoid my page numbers to be visualized in more than one line when I have a long list.
I've seen something like that,
<li ng-repeat="pageNumber in pages track by $index" ng-class="{ active : pagination.current == pageNumber, disabled : pageNumber == '...' }">
In another model (http://plnkr.co/edit/Wtkv71LIqUR4OhzhgpqL?p=preview) but so far ng-simplePagination is being great for me and I think I don't need to change.
Thanks!
i install it in bower components and my gulp serve is running, still when i try include it in the injector array in my app it gives me unknwon provider
where exactly should i include it
(function() {
'use strict';
angular
.module('airsole')
.controller('FrontBlogController', FrontBlogController);
FrontBlogController.$inject = ['$http','$state', '$sce','$scope', 'AuthService', '$rootScope', 'Notify','$localStorage', '$filter', 'pagination'];
function FrontBlogController($http, $state, $sce, $scope, AuthService, $rootScope, Notify, $localStorage , $filter, pagination) {
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.