Free tools Windows power users keep installed
One-click scans. No signup required.
An Angular component’s core consists of a TypeScript class, an HTML template and a CSS selector, configured with the @Component decorator. The class defines behavior, the template describes rendered content, and the selector identifies where the component is used. Styles and other metadata can extend that foundation, but they are not required parts of every component.
The three core parts of a component
Angular’s component guide describes a component through its class, template and selector. The @Component decorator connects these pieces by supplying metadata to Angular.
As an Amazon Associate I earn from qualifying purchases.
TypeScript class: behavior
The class contains the component’s logic—for example, handling user input or requesting data. Angular associates the class with its template and configuration through the decorator placed above it.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsHTML template: rendered content
The template defines the DOM Angular renders for the component. It can be written directly in the component metadata using template, or kept in a separate HTML file referenced by templateUrl. Templates combine HTML with Angular features such as data bindings and event listeners; Angular compiles them into JavaScript. See the official templates guide.
#1 Best Overall
Selector: where the component is used
The selector is a CSS selector that identifies the component in another template. For example, a parent template can contain an element matching a child component’s selector. Angular matches selectors statically at compile time: changing the DOM at runtime does not cause Angular to rematch components, and one element can match exactly one component selector. Details are in the selector guide.
What the @Component decorator configures
The object passed to @Component is metadata. It connects the class to its selector and template and can also specify styles and optional configuration. The Component API reference documents further options, including imports, inputs, outputs, providers, host bindings and queries.
Rank #2
Styles and encapsulation
Styles are optional. They can be supplied inline or from an external file and normally apply to elements in that component’s template. Angular supports Emulated, None and browser-native ShadowDom encapsulation policies. The compiler default is Emulated unless it is overridden.
How a component appears inside another component
To use a component in another standalone component, add the child component to the parent’s @Component metadata imports, then place an element matching the child’s selector in the parent template. Angular creates a component instance for each matching element.
Rank #3
The matching element is the child component’s host element. The DOM rendered from the child’s template is its view. Components nested this way form a component tree. Angular’s components essentials and components tutorial demonstrate this composition.
Standalone and NgModule-based components
Current Angular components are standalone by default. A standalone component lists the components, directives and pipes its template uses in its imports metadata.
Rank #4
The default changed in Angular 19: before version 19.0.0, standalone defaulted to false. In older NgModule-based projects, a non-standalone component is made available through its NgModule rather than by importing it directly into a standalone parent. When reading an older codebase, check the project’s Angular version and whether the component is standalone before looking for template dependencies.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteOptional features that expand a component
These features can shape a component’s public API or behavior, but they are not required parts of every component:
- Inputs let a component receive data through properties updated by Angular.
- Outputs expose event emissions that templates can listen for.
- Providers and queries configure dependency provision and access to relevant elements or directives.
- Host bindings connect component state with properties or behavior on its host element.
- Lifecycle hooks let a component respond at points in its creation, rendering, checking and destruction.
Angular checks bindings by traversing the application tree from top to bottom. Do not rely on a fixed ordering between a component lifecycle hook and a directive hook on the same element; Angular says that ordering is not guaranteed. See the lifecycle guide.
Host directives offer another optional composition mechanism. When a directive is applied through hostDirectives, its selector is ignored. Its inputs and outputs are not exposed through the component by default; map them explicitly when they should be part of the component’s public API. See Angular’s directive composition guide.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Recommended Free Tools




