How to Create a Standalone Component in Angular

To add such a component use the CLI like this:

import { Component } from '@angular/core';
import { CompanyInfoComponent } from "./company-info/company-info.component";
import { CommonModule } from '@angular/common';

@Component({
  selector: 'app-about',
  standalone: true,
  imports: [CommonModule, CompanyInfoComponent],
  templateUrl: './about.component.html',
  styleUrl: './about.component.scss'
})
export class AboutComponent {

}

As you can see the only difference to a normal Angular component, is that the decorator has two more properties:

  • standalone
  • imports

If you want to know more or have specifics, here is a link to my Github repo.