I know how to bind to events using the HostListener decorator like this:
@HostListener('document:mousemove', ['$event'])
onMousemove(event) {
//Some code on mouse movement.
}
But I would like to be able to bind and unbind to the mousemove event intermittently throughout the lifecycle of a component. I don't know what this type of binding is called, and I can't find anything about it. Should I try to use native JavaScript event binding?