diff --git a/demos/collection-repeat/index.html b/demos/collection-repeat/index.html new file mode 100644 index 0000000000..aaae4825f8 --- /dev/null +++ b/demos/collection-repeat/index.html @@ -0,0 +1,32 @@ + + + + + + Collection-Repeat: Early Preview + + + + + + + + + +

Try On a Phone

+ + Scroll Bottom + +
+ + +
+
+ {{item}} +
+
+
+ + diff --git a/demos/collection-repeat/script.js b/demos/collection-repeat/script.js new file mode 100644 index 0000000000..0de8f5f24d --- /dev/null +++ b/demos/collection-repeat/script.js @@ -0,0 +1,25 @@ +function MainCtrl($scope, $ionicScrollDelegate, $timeout) { + $scope.items = []; + for (var i = 0; i < 5000; i++) { + $scope.items.push('item '+i); + } + + $scope.getItemHeight = function(index) { + return 52 + 5 * (index % 5); + }; + + $scope.onRefresh = function() { + $timeout(function() { + $scope.items.unshift(-$scope.items.length); + $scope.items.unshift(-$scope.items.length); + $scope.items.unshift(-$scope.items.length); + $scope.items.unshift(-$scope.items.length); + $scope.items.unshift(-$scope.items.length); + $scope.$broadcast('scroll.refreshComplete'); + }, 1500); + }; + + $scope.scrollBottom = function(animate) { + $ionicScrollDelegate.scrollBottom(animate); + }; +} diff --git a/demos/collection-repeat/style.css b/demos/collection-repeat/style.css new file mode 100644 index 0000000000..b739c1f24a --- /dev/null +++ b/demos/collection-repeat/style.css @@ -0,0 +1,4 @@ +.item { + left: 0; + right: 0; +}