CodeZettaInterview Hub

Angular · Components · Fresh / Intern · Best Practice

What lifecycle hooks matter most for Angular components?

Short Interview Answer

ngOnInit for setup, ngOnDestroy for cleanup; view/content hooks when querying DOM/projected nodes.

Detailed Explanation

Constructor is for DI only. Use effects/signals for reactive updates instead of heavy ngOnChanges when possible. Always unsubscribe or destroy resources in ngOnDestroy (or takeUntilDestroyed).

Did you know this answer?