title: How to get triggered on scrolling inside cdk-virtual-scroll-viewport?
body: <p>I'm using virtual scroll with Angular 7. I create a <code>CdkVirtualScrollViewport</code> and I would add a listener to every scroll event. I mean I would like to be notified on scrolling inside that viewport.</p>
  
  <p>I tried to inject <code>scrollDispatcher</code> in my component, but I see that <code>scrolled()</code> is triggered on scrolling on the whole component, then I figure out that it is bind to the component instead of just to <code>CdkVirtualScrollViewport</code>.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>@ViewChild(CdkVirtualScrollViewport) virtualScroll: CdkVirtualScrollViewport;
  
  items: Array&lt;any&gt;;
  
  constructor(private scrollDispatcher: ScrollDispatcher, private cd: ChangeDetectorRef) {
  this.items = [];
  }
  
  ngOnInit(): void {
    for (let i = 0; i &lt; 100; i++) {
      this.items.push(i);
    }
  }
  
  ngAfterViewInit(): void {
  this.scrollDispatcher.scrolled()
    .subscribe(event =&gt; {
      console.log('scrolled');
    });
  }
  </code></pre>
  
  <p>As you can see <code>CdkVirtualScrollViewport</code> is a child element inside my component:</p>
  
  <pre><code>&lt;div class="header"&gt;
    {{header}}
  &lt;/div&gt;
  
  &lt;div class="container"&gt;
    &lt;cdk-virtual-scroll-viewport itemSize="4" class='example-viewport'&gt;
      &lt;li *cdkVirtualFor="let item of items" class='example-item' &gt;{{item}}&lt;/li&gt;
    &lt;/cdk-virtual-scroll-viewport&gt;
  &lt;/div&gt;
  
  &lt;div class="footer"&gt;
    {{footer}}
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is the full code: <a href="https://stackblitz.com/edit/angular7-scroll-dispatcher" rel="nofollow noreferrer">https://stackblitz.com/edit/angular7-scroll-dispatcher</a></p>
  
  <p>Maybe I could use <code>register()</code> method of <code>scrollDispatcher</code>... but I should pass a <code>CdkScrollable</code> to it, instead mine is a <code>CdkVirtualScrollViewport</code> element.</p>
  
  <p>Then, how can I listen only to my virtual scroll viewport scrolling events?</p>