aquint / ion-alpha-scroll

Alphabetically indexed list with alpha scroll bar.
99 stars 35 forks source link

Null is not an object #12

Open MilesYM opened 8 years ago

MilesYM commented 8 years ago

Hi guys,

First, thank you so much for this great plugin, so useful and time saving !

I’m getting a little bit confused here with some obscur error message.

I copied/paste the example and try to get a working example running. When trying to instantiate it, I’m running against an error:

Error: null is not an object (evaluating '$document[0].body.querySelector('.bar-header').offsetHeight') compile@http://localhost:8101/bower_components/ion-alpha-scroll/src/ion-alpha-scroll.js:25:70 applyDirectivesToNode@http://localhost:8101/bower_components/angular/angular.js:7930:39

I believe it come from the src files. I’m not sure what to do.

Do you know where is this coming from and how to fix it? Also, if someone could provide a working example in a fiddle that would greatly help!!!

Thanks !

MilesYM commented 8 years ago

Ok I fixed it this way:

var headerHeight = $document[0].body.querySelector('.bar-header') ? $document[0].body.querySelector('.bar-header').offsetHeight : 0;

I’m not sure where the bar-header class was supposed to go .. ?