What is the component in Angular?

Anil Kumar
May 1, 2021


Component is an element of the Angular app. They are the main building blocks. Each component is a type of directive. Component is made of class with Component metadata, html template, css selector and optionally css style apply to html template. Component have lifecycle hooks.

Cli command

ng g c app-component-overview

Syntax :-


selector: ‘app-component-overview’,

templateUrl: ‘./component-overview.component.html’,

styleUrls: [‘./component-overview.component.css’]


export class ComponentOverviewComponent {