Cannot read property 'scrollTo' of null (on uncached views)


#1

Apologies if this is an overlapping question, and I’ve seen this specific error logged during the RC releases of Ionic; however I still get this error both in the 1.0.1 and 1.1.0 public releases.

For me, this error is logging when transitioning between two uncached Views;

Cannot read property 'scrollTo' of null
    at ionic-angular.js:7070
    at processQueue (angular.js:13300)
    at angular.js:13316
    at completeOutstandingRequest (angular.js:4940)
    at angular.js:5328

The error doesn’t occur if the offending Views are cached, but our application logic dictates that we don’t want to cache the Views (as we have an API that needs to be refreshed each time we return to these Views)

Tracing the error, it looks like the $ionicScroll instance (I’m guessing the uncached View being unloaded) is $destroyed before $ionicScroll.scrollTop() is executed, at which point the local scrollView variable is null.

Anyone have any thoughts on how to resolve this? I could rewire our app to execute our init() functionality for the cached Views on, but I’d rather get to the bottom of this bug!


#2

Hi ,

Try this in your ion-headers

no-tap-scroll=“true”


#3

@rflea Cool; I put that in my <ion-nav-bar> and it fixed the issue. Thanks for the help :smile: