Creating Standalone Components
Explore how to create standalone components in Angular using the Angular CLI. Understand their structure, how they differ from traditional components tied to modules, and how they import necessary Angular features independently. This lesson helps you grasp a component-centric approach for faster prototyping and modular development.
We'll cover the following...
A component that is not registered with an Angular module is called a standalone component. Standalone components do not need a compilation context from an Angular module because they import any Angular artifacts they need by themselves. To create a standalone component using the Angular CLI, we pass the standalone option in the generate command that we learned about earlier:
Note: The command below is for creating a standalone component locally using the Angular CLI.
ng generate component product --standalone