Hi,
I’m using a carousel in my mobile app to load news categories in a view. I’ve been struggling for hours with $ionicScrollDelegate where handle cannot be found, see error message below.
Delegate for handle “handle_31” could not find a corresponding element with delegate-handle=“handle_31”!
scrollTop() was not called!
Possible cause: If you are calling scrollTop() immediately,
and your element with delegate-handle=“handle_31” is a child of your controller, then your element may not be compiled yet.
Put a $timeout around your call to scrollTop() and try again.
My view :
<div class="list card" ng-repeat="category in categories">
<ion-item class="item-stable title"
ng-click="toggleGroup(category.id)"
delegate-handle="handle_{{ category.id }}"
ng-class="{active: isGroupShown(category.id)}">
<h2><i class="icon" ng-class="isGroupShown(category.id) ? 'ion-minus' : 'ion-plus'"></i>
{{ 'category_' + category.alias | translate }}</h2>
</ion-item>
In my controller :
/*
* if given group is the selected group, deselect it
* else, select the given group
*/
$scope.toggleGroup = function(category) {
if ($scope.isGroupShown(category)) {
$scope.shownGroup = null;
} else {
$scope.shownGroup = category;
// if the toogle opens the current group, then scroll to the group title as defined in the view
$ionicScrollDelegate.$getByHandle('handle_' + category + '').scrollTop();
}
};
Has enyone ever faced this issue? If yes, how can this be solved?