Suggest an editImprove this articleRefine the answer for “How do you declare a component in Angular?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**Declaring a component** in Angular is done using the `@Component` decorator above a class, after which the component is added to the `declarations` array of the module (`NgModule`) so that Angular recognizes it. **Key point:** once declared, the component can be used in templates via its tag, for example `<app-my-component></app-my-component>`.Shown above the full answer for quick recall.Answer (EN)ImageIn Angular, a component is declared using the **decorator** `@Component` above a class. A simple example: ```typescript import { Component } from '@angular/core'; @Component({ selector: 'app-my-component', // tag name used in the template templateUrl: './my-component.component.html', // path to the HTML template styleUrls: ['./my-component.component.css'] // path to the styles }) export class MyComponent { title = 'Component example'; } ``` After that, the component needs to be **added to the** `declarations` **array** of the module (`NgModule`) so that Angular recognizes it: ```typescript @NgModule({ declarations: [MyComponent], imports: [...], bootstrap: [AppComponent] }) export class AppModule { } ``` Now the component can be used in templates via the tag `<app-my-component></app-my-component>`.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.