Lifecycle hooks run code as Angular creates, checks, and destroys a component
Answer: A component's lifecycle is the sequence of steps between its creation and its destruction. Each step is part of how Angular renders components and checks them for updates. You can implement lifecycle hooks to run code during those steps.
Hooks that belong to one component instance are methods on the component class. Hooks that belong to the application as a whole are functions that accept a callback. The constructor is the ordinary JavaScript class constructor and runs when Angular instantiates the component.
Angular walks the application tree from top to bottom, checking template bindings. Lifecycle hooks run during that traversal. The traversal visits each component once, so you should avoid further state changes in the middle of the process.
In source
Init hooks such as ngOnInit, ngAfterContentInit, and ngAfterViewInit must all run once and only once, across many change detection cycles. That remains true even if some hooks throw.
See also
Claims
- id: C1 claim: A component lifecycle is the sequence from creation to destruction. source: S1 evidence: "A component's lifecycle is the sequence of steps that happen between the component's creation"
- id: C2 claim: You implement lifecycle hooks to run code during those steps. source: S1 evidence: "you can implement lifecycle hooks to run code during these steps."
- id: C3 claim: Init hooks must execute once and only once. source: S2 evidence: "Init hooks (ngOnInit, ngAfterContentInit, ngAfterViewInit) must all be executed once and only"
Sources
- [S1] Component lifecycle hooks. Angular docs. https://angular.dev/guide/components/lifecycle . License: CC BY 4.0. Accessed 2026-11-11.
- [S2] Lifecycle hook callbacks. Angular source. https://github.com/angular/angular/blob/main/packages/core/src/render3/hooks.ts . License: MIT. Accessed 2026-11-11.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: Angular documentation (angular/angular adev): Copyright (c) 2010-2026 Google LLC; CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Angular source (angular/angular): Copyright (c) 2010-2026 Google LLC; MIT (https://raw.githubusercontent.com/angular/angular/main/LICENSE). Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Angular docs, CC BY 4.0 text (angular/angular adev footer); Angular source, MIT (angular/angular). Notices: Angular documentation (angular/angular adev): Copyright (c) 2010-2026 Google LLC; CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Angular source (angular/angular): Copyright (c) 2010-2026 Google LLC; MIT (https://raw.githubusercontent.com/angular/angular/main/LICENSE).
Cite this
iinventedlight. 2026. "Angular lifecycle hooks run during create, check, and destroy." iinventedlight Library, iil:note:1hr32bf9, version of 2026-11-11. https://iinventedlight.com/library/notes/angular-lifecycle-hooks/. License: CC-BY-4.0.
@misc{iil_note_1hr32bf9,
author = {{iinventedlight}},
title = {{Angular lifecycle hooks run during create, check, and destroy}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-11},
url = {https://iinventedlight.com/library/notes/angular-lifecycle-hooks/},
note = {Permanent ID iil:note:1hr32bf9. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/angular-lifecycle-hooks.md.