OK, so this might have already been asked and answered, but I couldn't find it. In my HTML, I have declared a listener to the window.scroll event. Since this is only declared in my HTML,
- is there a way to unbind the scroll event? Can I do it through
ngOnDestroy()? If so, how? - OR is it safe to not unbind it and assume that NG2 will clean up the mess when the component is destroyed?
I'm using Angular2 RC.1.
My HTML:
<div (window:scroll)="bindToScrollEventFunc()"></div>
I'm a little worried that if the component is destroyed, the listening function will still be around in memory and cause problems if it is not unbound. Any info on the matter is greatly appreciated! TIA!