Unnikrishnan M R
Unnikrishnan M R

Reputation: 224

Ngx-Perfect-Scrollbar not working

I have been trying to make the ngx-perfect-scrollbar work. I have installed the library using

npm install ngx-perfect-scrollbar --save

after that I have added the dependency into my app.module.ts. But when i run the app it gives error

Object(...) is not a function

I don't know what I am doing wrong here. All the steps have been followed as per in github repo.

This is the error that I am seeing

Error is generated from line number 126

ngx-perfect-scrollbar file code

This is my html file

<div class="ps" style="position: relative; max-width: 600px; max-height: 400px;" [perfectScrollbar]="config">
    <router-outlet></router-outlet>
 </div>

Upvotes: 0

Views: 7833

Answers (2)

Parthasarathi Sahoo
Parthasarathi Sahoo

Reputation: 1

I had the same issue when running Angular 5. I had installed ngx-perfect-scrollbar 6.x, downgrading with the following commands resolved the issue for me:

npm remove ngx-perfect-scrollbar

npm install --save ngx-perfect-scrollbar@^5.0.0

Upvotes: 0

MortezaDalil
MortezaDalil

Reputation: 361

Add these line to your component header:

import { fromEvent } from 'rxjs/observable/fromEvent';
import { merge } from 'rxjs/observable/merge';

require('rxjs').fromEvent = fromEvent
require('rxjs').merge = merge

source

Upvotes: 1

Related Questions