I have a function that takes a component instance and overrides the ngOnDestroy hook:
export function patch(instance) {
instance['ngOnDestroy'] = function() {
console.log('ngOnDestroy');
}
}
And in the component:
ngOnInit() {
patch(this);
}
But I don't see the log when the component is destroyed. Why it's not working?