Create Standalone Components in Angular

In this Tutorial, we will create two components UserList Component and the UserForm Component.

1. Create User List Component

Create a user list component through the command below


ng generate component user-list --standalone

It will create files like


src/app/user-list/user-list.component.ts
src/app/user-list/user-list.component.html

Now, you will see in the userList component


@Component({
  selector: 'app-user-list',
  standalone: true,
  templateUrl: './user-list.component.html',
  styleUrl: './user-list.component.css'
})

2. Create User Form Component

Create a user form component through the following command


ng generate component user-form --standalone

Now, you will see in the userForm component


@Component({
  selector: 'app-user-form',
  standalone: true,
  templateUrl: './user-form.component.html',
  styleUrl: './user-form.component.css'
})

Note: You will see standalone true and No module needed.