$ionicScrollDelegate missing handle error

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> &nbsp;
                    {{ '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?

1 Like

I’ve tried the solution in the error message like this:

$timeout(function () {
    $ionicScrollDelegate.$getByHandle('handle_' + category + '').scrollTop();
});

But no chance, same error message

This is a known issue with ionic going back to last year. Not fixed yet but there are some hacks: https://github.com/driftyco/ionic/issues/2754

I haven’t gotten anything to work yet with my slide box in a modal.