Component

noun

say it: “kum-POH-nent” /kəmˈpoʊnənt/

A building block of an Angular page: a TypeScript class plus its HTML template.

What is Component?

A component is a building block of an Angular page: a TypeScript class plus an HTML template (and optional styles). A page is a tree of components, such as a header, a product list and a product card.

import { Component } from '@angular/core';

@Component({
  selector: 'app-greeting',
  template: `<h1>Hello, {{ name }}!</h1>`,
})
export class Greeting {
  name = 'Maria';
}

In a sentence

  • “The price tag is its own component, used on every product page.”

Level: Novice · More Angular terms at this level

Updated