I have problem. Angular is sometimes showing error ERROR TypeError: Cannot read properties of undefined (reading 'onDestroy')
I am getting this error when I am running ng serve, but if I use angular universal, then page is sometimes loading properly and sometimes it is showing same error. I found out, that this error started when I started making modularization of my app.
Angular version 13.3
This happened when I was trying to use components in an ngSwitchCase that rendered ng-templates with components in them.
The components that did not
implement ngOnDestroy
would give me this error.short answer, try adding ngOndestroy to components that might be rendering on the fly?