Components

In this lesson, we will see what components are, how we can create them, and how they get rendered under the hood.

intro-components

You can think of your Angular application as a set of components. These components work together to build a single-page application and communicate with each other.

A component is also the most basic building block of Angular. It has a class where we define the business logic and a view that renders the properties and methods defined in the class.

Syntax of a component declaration

We will start with understanding the component declaration syntax, followed by how a component definition is created by the compiler, and how it is rendered in the browser.

@Component({
  selector: 'app-child-one',
  templateUrl: './child-one.component.html',
  styleUrls: ['./child-one.component.scss']
})
export class ChildOneComponent{ }
...