Skip to content

Commit

Permalink
fix(collectionRepeat): when array is empty, dont use heightGetter/wid…
Browse files Browse the repository at this point in the history
…thGetter

Closes #3440.
  • Loading branch information
ajoslin committed Apr 14, 2015
1 parent eb2ed81 commit bd4723c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions js/angular/directive/collectionRepeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,14 @@ function RepeatManagerFactory($rootScope, $window, $$rAF) {
var isLayoutReady = false;
var isDataReady = false;
this.refreshLayout = function(itemsAfterRepeater) {
estimatedHeight = heightGetter(0, data[0]);
estimatedWidth = widthGetter(0, data[0]);
if (data.length) {
estimatedHeight = heightGetter(0, data[0]);
estimatedWidth = widthGetter(0, data[0]);
} else {
// If we don't have any data in our array, just guess.
estimatedHeight = 100;
estimatedWidth = 100;
}

// Get the size of every element AFTER the repeater. We have to get the margin before and
// after the first/last element to fix a browser bug with getComputedStyle() not counting
Expand Down

0 comments on commit bd4723c

Please sign in to comment.