Angularjs $ionicScrollDelegate.$getByHandle()不工作。为什么?

Angularjs $ionicScrollDelegate.$getByHandle()不工作。为什么?,angularjs,ionic-framework,Angularjs,Ionic Framework,我想将一个项目滚动到屏幕顶部。当按下该项时。我正在使用以下代码 <ion-list id="iphoneTutorials-list2" ng-repeat="(f,chapter) in iphoneVideos"> <ion-item style="border-left: none;border-right: none;border-top: none;" class="item-text-wrap" ng-click="toggledisplay($inde

我想将一个项目滚动到屏幕顶部。当按下该项时。我正在使用以下代码

<ion-list id="iphoneTutorials-list2" ng-repeat="(f,chapter) in iphoneVideos">
      <ion-item style="border-left: none;border-right: none;border-top: none;" class="item-text-wrap" ng-click="toggledisplay($index)" delegate-handle="$index"><i class="icon ion-ios-arrow-right" ng-if="!trigger[$index]"></i>
     <i class="icon ion-ios-arrow-down" ng-if="trigger[$index]"></i> {{chapter.chapter_name}}</ion-item>
      <ion-list ng-show="trigger[$index]">
        <ion-item class="item-text-wrap" ng-click="openVideo(video.video_id,video.video_name,f,$index,video.Description)" style="margin-left: 10%;border-left: none;border-right: none;"  ng-repeat="video in chapter.chapter_content">{{video.video_name}}</ion-item>
      </ion-list>
这是我在控制台中收到的消息:

ionic.bundle.js:26799 Delegate for handle "7" could not find a corresponding element with delegate-handle="7"! scrollTop() was not called!
Possible cause: If you are calling scrollTop() immediately, and your element with delegate-handle="7" 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.

有什么能帮我解决我的问题吗?

问题是$timeout需要一个函数作为第一个参数,而您正在执行一个函数。必须从
scrollTop()
方法中删除括号:

$timeout($ionicScrollDelegate.$getByHandle(index).scrollTop,3000);

现在,函数将在
3000
ms之后在正确的上下文中执行(可以找到处理程序)

问题在于$timeout需要一个函数作为第一个参数,而您正在执行一个函数。必须从
scrollTop()
方法中删除括号:

$timeout($ionicScrollDelegate.$getByHandle(index).scrollTop,3000);

现在,函数将在
3000
ms之后在正确的上下文(可以找到处理程序)中执行

这是ionic v1,对吗?这是ionic v1,对吗?