"Cannot read property 'scrollTop' of undefined"

Trying to work with this codepen but running into the error “Cannot read property ‘scrollTop’ of undefined”

Here’s my directive

.directive(‘scrollWatch’, function($rootScope) {
return function(scope, elem, attr) {
var start = 0;
var threshold = 150;

elem.bind('scroll', function(e) {
  if(e.detail.scrollTop - start > threshold) {
    $rootScope.slideHeader = true;
  } else {
    $rootScope.slideHeader = false;
  }
  if ($rootScope.slideHeaderPrevious >= e.detail.scrollTop - start) {
    $rootScope.slideHeader = false;
  }
  $rootScope.slideHeaderPrevious = e.detail.scrollTop - start;
  $rootScope.$apply();
});

};
})

hi Kole

I have the same problem.do you find any solution I am using the ionic version 1.2.4

cannot read property scrollTop of undefined.

I have same problem on android doesn’t work…

Same problem here. Cannot get the ‘scrollTop’ property on Android (5.1.1).

Is there a solution for this ?