New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simple-angular-pagination

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-angular-pagination - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

111

index.js

@@ -1,51 +0,66 @@

define(function(require){
var $ = require('jquery');
var angular = require('angular');
var $ = require('jquery');
var angular = require('angular');
angular.module('Pagination', [])
.directive('pages', ['$compile', function($compile){
return {
compile: function(tElem, tAttrs){
var pages = $(tElem).find('> page').detach();
return {
post: function(scope, el){
var currentPage;
var changePage = scope.changePage = function(page) {
if ($.isNumeric(page)) {
// Do -1 so the API makes sense. In other words, changePage(2)
// will get you actual page 2 even though its index is 1
currentPage = (page - 1);
} else if (page == '+') {
currentPage++;
} else if (page == '-') {
currentPage--;
}
el.empty();
el.append($compile($(pages[currentPage]).clone())(scope));
};
changePage(1);
scope.next = function(){
scope.changePage('+');
};
scope.prev = function(){
scope.changePage('-');
};
}
};
}
};
}])
.directive('next', function(){
return {
replace: true,
template: '<button class="primary" ng-click="next()">Next</button>'
};
})
.directive('prev', function(){
return {
replace: true,
template: '<button ng-click="prev()">Previous</button>'
};
});
angular.module('Pagination', [])
.directive('pages', ['$compile', '$timeout', function($compile, $timeout){
return {
compile: function(tElem, tAttrs){
var pages = $(tElem).find('> page').detach();
return {
post: function(scope, el){
var currentPage, changing;
var changePage = scope.changePage = function(page) {
// If the page is already changing, let's give it
// a moment and try again. This gives the DOM time
// to do it's thing to multiple pages don't render
// at once
if (changing) {
return $timeout(function(){
scope.changePage(page);
}, 10);
}
changing = true;
if ($.isNumeric(page)) {
// Do -1 so the API makes sense. In other words, changePage(2)
// will get you actual page 2 even though its index is 1
currentPage = (page - 1);
} else if (page == '+') {
currentPage++;
} else if (page == '-') {
currentPage--;
}
el.empty();
el.append($compile($(pages[currentPage]).clone())(scope));
$timeout(function(){
changing = false;
}, 100);
};
changePage(1);
scope.next = function(){
scope.changePage('+');
};
scope.prev = function(){
scope.changePage('-');
};
}
};
}
};
}])
.directive('next', function(){
return {
replace: true,
template: '<button class="primary" ng-click="next()">Next</button>'
};
})
.directive('prev', function(){
return {
replace: true,
template: '<button ng-click="prev()">Previous</button>'
};
});
});
{
"name": "simple-angular-pagination",
"description": "Super simple pagination for angular apps",
"version": "0.0.3",
"version": "0.0.4",
"main": "index.js",

@@ -14,5 +14,5 @@ "repository": {

"dependencies": {
"jquery": "latest",
"angular": "latest"
"jquery": "^3.0.0",
"angular": "^1.6.7"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc