Components

Components are a key part of every modern UI framework. The idea is simple: you decompose the application visually into smaller encapsulated and reusable units, called components.

Let's review the auto-generated AppComponent component:

import { Component } from '@angular/core';@Component({   selector: 'app-root',   templateUrl: './app.component.html',   styleUrls: ['./app.component.css'] }) export class AppComponent {   title = 'app'; }

Just like modules, Angular components are classes with an @Component decorator. The decorator receives a configuration object with the following relevant key properties:

  • selector: This is the selector element associated with the given component. This selector is used in templates where this component should ...

Get Hands-On Full-Stack Web Development with ASP.NET Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.