Javascript 有没有办法在npm包的ng multi-selectdropdown中添加(滚动)事件
要求:我想在下面的html代码中添加一个滚动事件,该事件应在该div的滚动中触发,我无法添加一个滚动事件,该事件将在滚动元素时触发Javascript 有没有办法在npm包的ng multi-selectdropdown中添加(滚动)事件,javascript,html,angular,Javascript,Html,Angular,要求:我想在下面的html代码中添加一个滚动事件,该事件应在该div的滚动中触发,我无法添加一个滚动事件,该事件将在滚动元素时触发 使用@ViewChild获取elementRef并在滚动容器元素上注册scroll事件处理程序。对于exmaple: @ViewChild(Component, { read: ElementRef, static: true }) dropdown: ElementRef ngOnInit() { const dropdownRef = this.drop
使用@ViewChild
获取elementRef
并在滚动容器元素上注册scroll
事件处理程序。对于exmaple:
@ViewChild(Component, { read: ElementRef, static: true }) dropdown: ElementRef
ngOnInit() {
const dropdownRef = this.dropdown.nativeElement;
const scrollingContainerRef = dropdownRef.querySelector('selector');
scrollingContainerRef.addEventListener('scroll', event => {});
}