Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing a divide-by-zero error #176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 1.1.8 (2017/09/15)
=================

* Fixed a divide-by-zero issue that could prevent items from rendering

Version 1.1.7 (2016/03/08)
=================

Expand Down
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = function(grunt){
banner: [
'//',
'// Copyright Kamil Pękala http://github.com/kamilkp',
'// Angular Virtual Scroll Repeat v1.1.7 2016/03/08',
'// Angular Virtual Scroll Repeat v1.1.8 2017/09/15',
'//',
''
].join('\n')
Expand Down Expand Up @@ -47,4 +47,4 @@ module.exports = function(grunt){
grunt.registerTask('test', 'Run unit tests', ['jshint', 'min', 'karma:unit']);
grunt.registerTask('default', ['test']);
grunt.registerTask('travis', ['jshint', 'min', 'karma:travis']);
};
};
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular-vs-repeat v1.1.7
angular-vs-repeat v1.1.8
=================

Looking for a version for Angular 2?
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-vs-repeat",
"version": "1.1.7",
"version": "1.1.8",
"description": "Virtual Scroll for AngularJS ngRepeat directive",
"homepage": "http://kamilkp.github.io/angular-vs-repeat",
"main": "src/angular-vs-repeat.js",
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-vs-repeat",
"version": "1.1.7",
"version": "1.1.8",
"description": "Virtual Scroll for AngularJS ngRepeat directive",
"homepage": "http://kamilkp.github.io/angular-vs-repeat",
"author": {
Expand All @@ -26,7 +26,10 @@
"karma-firefox-launcher": "~0.1.3"
},
"scripts": {
"test": "grunt travis"
"test": "grunt travis --force"
},
"dependencies": {}
"dependencies": {
"grunt-cli": "^1.2.0",
"travis": "^0.1.1"
}
}
10 changes: 8 additions & 2 deletions src/angular-vs-repeat.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Copyright Kamil Pękala http://github.com/kamilkp
// Angular Virtual Scroll Repeat v1.1.7 2016/03/08
// Angular Virtual Scroll Repeat v1.1.8 2017/09/15
//

(function(window, angular) {
Expand Down Expand Up @@ -512,7 +512,7 @@
originalLength
);
}
else {
else if ($scope.elementSize > 0) {
__startIndex = Math.max(
Math.floor(
($scrollPosition - $scope.offsetBefore - scrollOffset) / $scope.elementSize
Expand All @@ -527,6 +527,12 @@
originalLength
);
}
else {
// Don't try to divide by zero, just default to the size of the
// array
__startIndex = 0;
__endIndex = originalLength;
}

_minStartIndex = Math.min(__startIndex, _minStartIndex);
_maxEndIndex = Math.max(__endIndex, _maxEndIndex);
Expand Down
4 changes: 2 additions & 2 deletions src/angular-vs-repeat.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.