Disclaimer: its not recommended for components to attach events outside their own view scope. I will answer your question nonetheless
To get parent element try this answer
Then to attach an event to that parent element, see this answer
I setup an example plunker:
https://plnkr.co/edit/fO3oT74UP1HO8jVrJe5n?p=preview
code:
//our root app component
import {Component, NgModule, VERSION, ElementRef, Renderer} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'
@Component({
selector: 'my-app',
template: `
<div style="height:100px; overflow:scroll">
<h2>Hello {{name}}</h2>
<child></child>
</div>
`,
})
export class App {
name:string;
constructor() {
this.name = `Angular! v${VERSION.full}`
}
}
@Component({
selector: 'child',
template: `
<h2>this is child comp</h2>
<h2>this is child comp</h2>
<h2>this is child comp</h2>
<h2>this is child comp</h2>
<h2>this is child comp</h2>
`,
})
export class Child{
constructor(elementRef:ElementRef, renderer: Renderer) {
var parent = elementRef.nativeElement.parentElement;
renderer.listen(parent, 'scroll', (event) => {
console.log(event);
})
}
}
@NgModule({
imports: [ BrowserModule ],
declarations: [ App, Child ],
bootstrap: [ App ]
})
export class AppModule {}