← All notes

An Angular component is a class plus a template and a selector

Answer: Every Angular component needs three pieces: a TypeScript class for behavior, an HTML template that controls what is rendered into the DOM, and a CSS selector that says how the component is used in HTML. You attach Angular-specific information with a @Component decorator on the class.

Metadata

The object passed to @Component is the component's metadata. It includes the selector, the template, and other properties. Styles listed on the component apply to that component's DOM. By default those styles only affect elements defined in that component's template.

Templates and styles may live in the decorator or in separate files via templateUrl and styleUrl. Both paths are relative to the directory in which the component resides.

The decorator in source

The @Component decorator marks a class as an Angular component and supplies configuration metadata. That metadata determines how the component is processed, instantiated, and used at runtime.

See also

Claims

Sources

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

Permanent ID: iil:note:zbdyjegf

iinventedlight. 2026. "Angular components combine a class, a template, and a selector." iinventedlight Library, iil:note:zbdyjegf, version of 2026-11-11. https://iinventedlight.com/library/notes/angular-components/. License: CC-BY-4.0.

@misc{iil_note_zbdyjegf,
  author = {{iinventedlight}},
  title = {{Angular components combine a class, a template, and a selector}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-11},
  url = {https://iinventedlight.com/library/notes/angular-components/},
  note = {Permanent ID iil:note:zbdyjegf. License: CC-BY-4.0.},
}

Markdown

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-components.md.