Issue with $ionicScrollDelegate: Unknown provider


#1

Hi there,

New to ionic, and trying to figure out why I can’t get ionicScrollDelegate to work correctly. I have this following markup:

 <content has-header="true" on-refresh="refreshFriends()" padded="true">
          <ion-scroll delegate-handle="myScroll">
          <refresher></refresher>
          ....
         </ion-scroll>
</content>

And then in the controller:

angular.module('starter.controllers', [])

    .controller('MenuCtrl', function($scope, $ionicScrollDelegate, $http, $location, APIService) {
    
        var delegate = $ionicScrollDelegate.$getByHandle('myScroll');
    
        delegate.rememberScrollPosition('my-scroll-id');
        delegate.scrollToRememberedPosition();
        .....

});

However, on load - I get this error in the console:

Error: [$injector:unpr] Unknown provider: $ionicScrollDelegateProvider <- $ionicScrollDelegate

Any advice here? I am loading content in a ng-view, like this:

APIService.async().then(function(d) {
      if (d.meta.code == 200) {
        $scope.checkins = d.response.checkins.items;

      }
    });

So I’m not sure if there a timing thing here, but I placed the declaring of the $ionicScrollDelegate, inside this async function and had no luck.

I believe I am following the directions correctly. Thanks!


#2

Just got the same issue myself, did you solve this?


#3

i also have the same issue.


#4

I think that this is the problem:

you’ll have to change it to this:

angular.module('starter.controllers', ['ionic'])