I have a component that listens for a click event
, simplified parts below:
@Component({
selector: '[sortable-column]',
templateUrl: './sortable-column.component.html'
})
export class SortableColumnComponent implements OnInit, OnDestroy {
@HostListener('click') doSomething() {
}
constructor() {
}
ngOnInit() {
}
ngOnDestroy() {
}
}
and the template:
<th sortable-column>name</th>
When running this, if I never click on the <th>
the component get's garbage collected properly, if I do click on it, then the component gets stuck in memory... I thought that the HostListener cleaned up the underlying event handler?
What am I missing here?