Angular 8 : Uncaught ReferenceError: OverlayScrollbars is not defined

Viewed 285

I am using a overlay scrollbars plugin in my angular app which has an extension called OS-Scroll-chain to prevent scroll chaining. I already have installed all the packages.

I have added the cdn in my index.html -

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/os-scroll-chain@1/dist/os-scroll-chain.min.js"></script>

I have added these in my main.ts file

import * as scrollChain from 'os-scroll-chain';
import OverlayScrollbars from 'overlayscrollbars';
OverlayScrollbars.extension('scroll-chain', scrollChain );

Then in my custom overlay scrollbar component I have used this -

ngAfterViewInit() {
  this._osInstance = OverlayScrollbars(this.osTarget(), this.config || {});
  this._osInstance.addExt('scroll-chain', {vertical: true, horizontal: false})
}
0 Answers
Related