From 4ac54830175a5d1071326f84c5eec7523792186e Mon Sep 17 00:00:00 2001 From: Andy Joslin Date: Wed, 23 Apr 2014 17:52:34 -0600 Subject: [PATCH] demo(collection-repeat): add basic demo --- demos/collection-repeat/index.html | 32 ++++++++++++++++++++++++++++++ demos/collection-repeat/script.js | 25 +++++++++++++++++++++++ demos/collection-repeat/style.css | 4 ++++ 3 files changed, 61 insertions(+) create mode 100644 demos/collection-repeat/index.html create mode 100644 demos/collection-repeat/script.js create mode 100644 demos/collection-repeat/style.css 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; +}