0Pricing
Angular Academy · Lesson

Creating Standalone Components

Declare components with the standalone flag.

Creating a Standalone Component

A standalone component is just a class decorated with @Component that is marked standalone. In Angular v19+ this is the default, so you often do not even write the flag.

The standalone Flag

Historically you set standalone: true in the decorator. In v19 and later, components are standalone by default, so the flag is optional.

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

@Component({
  selector: 'app-greeting',
  standalone: true, // optional in v19+
  template: '<h1>Welcome</h1>'
})
export class GreetingComponent {}

All lessons in this course

  1. Why Standalone Components
  2. Creating Standalone Components
  3. Importing Dependencies Directly
  4. Bootstrapping a Standalone App
← Back to Angular Academy