fix(collectionRepeat): always render data correctly with before/after isblings

Closes #2025
This commit is contained in:
Andrew
2014-08-20 11:21:22 -06:00
parent beecc6274e
commit 120f99ee79
2 changed files with 8 additions and 3 deletions

View File

@@ -81,8 +81,13 @@ function($cacheFactory, $parse, $rootScope) {
attachItemAtIndex: function(index) {
if (index < this.dataStartIndex) {
return this.beforeSiblings[index];
} else if (index > this.data.length - 1) {
return this.afterSiblings[index - this.data.length - this.dataStartIndex];
}
// Subtract so we start at the beginning of this.data, after
// this.beforeSiblings.
index -= this.dataStartIndex;
if (index > this.data.length - 1) {
return this.afterSiblings[index - this.dataStartIndex];
}
var item = this.getItem(index);

View File

@@ -106,7 +106,6 @@ function($rootScope, $timeout) {
primaryPos = secondaryPos = 0;
previousItem = null;
var dimensions = this.dataSource.dimensions.map(calculateSize, this);
var totalSize = primaryPos + (previousItem ? previousItem.primarySize : 0);
@@ -310,6 +309,7 @@ function($rootScope, $timeout) {
renderItem: function(dataIndex, primaryPos, secondaryPos) {
// Attach an item, and set its transform position to the required value
var item = this.dataSource.attachItemAtIndex(dataIndex);
console.log(dataIndex, item);
if (item && item.element) {
if (item.primaryPos !== primaryPos || item.secondaryPos !== secondaryPos) {
item.element.css(ionic.CSS.TRANSFORM, this.transformString(