Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 有没有办法在npm包的ng multi-selectdropdown中添加(滚动)事件_Javascript_Html_Angular - Fatal编程技术网

Javascript 有没有办法在npm包的ng multi-selectdropdown中添加(滚动)事件

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

要求:我想在下面的html代码中添加一个滚动事件,该事件应在该div的滚动中触发,我无法添加一个滚动事件,该事件将在滚动元素时触发


使用
@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 => {});
}