scroll: add $ionicScrollDelegate with new pattern

Addresses #877
This commit is contained in:
Andy Joslin
2014-03-24 15:56:23 -06:00
parent b1a7c1990a
commit c1d2571d5e
12 changed files with 437 additions and 152 deletions

View File

@@ -10,7 +10,7 @@
</head>
<body>
<ion-toggle ng-model="shouldShowScrollView"></ion-toggle>
<ion-scroll ng-if="shouldShowScrollView">
<ion-scroll delegate-handle="myScroll" ng-if="shouldShowScrollView">
<div ng-controller="ScrollCtrl">
<ion-list>
<ion-item ng-repeat="i in items">{{i}}</ion-item>
@@ -18,9 +18,11 @@
</div>
</ion-scroll>
<script>
function ScrollCtrl($scope) {
$scope.$ionicScrollController.rememberScrollPosition('my-scroll-id');
$scope.$ionicScrollController.scrollToRememberedPosition();
function ScrollCtrl($scope, $ionicScrollDelegate) {
var delegate = $ionicScrollDelegate.withHandle('myScroll');
delegate.rememberScrollPosition('my-scroll-id');
delegate.scrollToRememberedPosition();
$scope.items = [];
for (var i=0; i<100; i++) {