I am trying to use ngx-scrollbar in one of the component but when I am using on the other component it is throwing error
ngx-scroolbar: 4.1.1 Angular: 7
exampleComponent.ts
<div>
<ng-scroolbar [autohide]=true > </ng -scrollbar>
</div>
s
someothercomponet.ts
<example-component></example-component>
I am getting the below error in the browser console of the ngx-scroolbar.js
get view() {
return this.customViewPort
? this.customViewPort.virtualScrollViewport.getElementRef().nativeElement
: this.scrollViewport.getElementRef().nativeElement;
}
**ERROR TypeError: Cannot read property 'getElementRef' of undefined**
at NgScrollbar.get view [as view] (ngx-scrollbar.js:365)
at NgScrollbar.showScrollbarY (ngx-scrollbar.js:398)
at Object.updateRenderer (ngx-scrollbar.d.ts.NgScrollbar.html:19)
at Object.debugUpdateRenderer [as updateRenderer] (core.js:47005)
at checkAndUpdateView (core.js:45987)
at callViewAction (core.js:46347)
at execEmbeddedViewsAction (core.js:46304)
at checkAndUpdateView (core.js:45982)
at callViewAction (core.js:46347)
at execComponentViewsAction (core.js:46275)