Can I use anchorScroll with collection-repeat?


#1

I try to use anchorScroll with collection-repeat.
this is my code.

<ul class=list" id="downloadList" animation="slide-left-right">
    <a id="{{pack.packageId}}"
         collection-repeat="pack in packs | filter:downloadText
         collection-item-width="'100%'"
         collection-height="70"
         style="width:100%"
         class="item item-avatar"
         ng-href="#/app/download/{{pack.packageId}}">
             <img ng-src="{{...}}" alt="{{pack.packageId}}">
             <h2>{{pack.packageId}}</h2>
             <h3>{{pack.title[i8n] || pack.title.en}}</h3>
    </a>
</ul>

and try to scroll to the id

$location.hash(id);
$ionicScrollDelegate.anchorScroll());

But failed. If i replace collection-repeat with ng-repeat, it works.
Is it impossble to locate the position with collection-repeat?

update:
I use scrollBy and getElementId to find the ID.
But there are some problem.

  1. It’s too slow!
  2. $ionicScrollDelegate.scrolBy don’t have callback function. I need a magic setTimeout value to delay it.
    Any better solution?

#2

some issue here, any updates?


#3

Same for me.
Issues with collectionRepeat not working with anchorScroll.

<ion-content has-header="true" delegate-handle="EventsScroll">
	<div class="list collection-list">
		<div class="item collection-item item-icon-right wa_middle"
			collection-repeat="item in listEchanges"
			collection-item-height="getItemHeight(item)"
			collection-item-width="'100%'"
			id="{{item.id}}" >
			<div  class="inline-block">
				<div>{{item.date || item.displayName }}</div>
			</div>
		</div>
	</div>
</ion-content>

I define an ID with : id="{{item.id}}" and I’m looking for the id="0"
On the controller :

$scope.scrollTo = function (id) {
   $location.hash(id);
   var delegateHandle = $ionicScrollDelegate.$getByHandle('EventsScroll');
   delegateHandle.anchorScroll(id);
};

$timeout(function() {
	// $ionicScrollDelegate.$getByHandle('EventsScroll').scrollBottom(); // WORKING
	$scope.scrollTo('0'); // **NOT WORKING and I have an id="0" in my DOM**
}, 2000);

#4

Can you give us an example with what you explained in your update ?
thank you.