本文转自:https://blog.csdn.net/ittvibe/article/details/80060801
转自:http://brianflove.com/2016/10/10/angular-2-window-scroll-event-using-hostlistener
import { HostListener} from "@angular/core";
@HostListener("window:scroll", [])
onWindowScroll() {
//we'll do some stuff here when the window is scrolled
}