EventListener in angular with Callback gives error in firefox ERROR ReferenceError: "event is not defined"

EventListener in angular with Callback gives error in firefox ERROR ReferenceError: "event is not defined"

我想在 window 滚动事件上加载数据 这是我的代码:

 private scrollChangeCallback: () => void;

  ngOnInit() {
    this.scrollChangeCallback = () => this.handleWindowScroll(event);
    window.addEventListener('scroll', this.scrollChangeCallback, true);
 }

  handleWindowScroll = (event): void => {
    const total = this.sites.length;
    const page = this.getPageForIndex(total);
     let bottomPosition = event.srcElement.scrollTop + window.innerHeight + 25;
     let scrolledHeight = event.srcElement.scrollHeight;
     if (this.sites != null && bottomPosition > scrolledHeight && !this.theEnd && total >= this.pageSize) {
      this.siteRepositoryService.loadSites(this.searchTerm, page);
       this.subscribeOnScroll();
   }
 }

它在 firefox ReferenceError 上给出错误:事件未定义。 我已经尝试了所有可能的解决方案并为此花费了足够的时间但是它不起作用有人可以帮助我吗?

我已经通过两种方式解决了这个错误:

  1. 更新火狐
  2. 使用 ngAfterViewInit 而不是 ngOnInit