微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

其他组件内部的角度ngx-scrollbar投掷错误

如何解决其他组件内部的角度ngx-scrollbar投掷错误

我正在尝试在其中一个组件中使用ngx-scrollbar,但是当我在另一个组件中使用它时会抛出错误

ngx-scroolbar:4.1.1 角度:7
exampleComponent.ts

<div>
<ng-scroolbar [autohide]=true > </ng -scrollbar>
</div>

s

someothercomponet.ts

<example-component></example-component>

我在ngx-scroolbarbar.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)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。