Member-only story

Angular standalone components

How to generate, bootstrap, and lazy load Angular standalone components.

6 min readMay 12, 2022

In version 14, Angular will release an impressive new feature named standalone components. Standalone components allow us to write Angular applications without NgModules.

Why standalone components? Standalone components means no NgModules. NgModules are often confusing for new Angular developers. It’s an additional Angular-specific concept and there’s often confusion between Angular Modules and ES modules. Furthermore, standalone components can be really useful for applications that use the SCAM architecture pattern.

In this blog post, we will find out how we can create an application with a prerelease version of Angular, how we can bootstrap a standalone component, how we can use Angular schematics to generate a standalone component, and how we can finally lazy load a standalone component.

☝️ Standalone components aren’t yet officially released. Therefore, throughout this article, we use a pre-release version. The API might still change once the final version is released. Of course, I will then update this article.😉

Generate an application with a prerelease version

npx @angular/cli@next new lonely-components

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Kevin Kreuzer
Kevin Kreuzer

Written by Kevin Kreuzer

Passionate freelance frontend engineer. ❤️ Always eager to learn, share and expand knowledge.

Responses (4)

Write a response

When I'm using standalone component it is working, but I have warning in my IDEA - ' component is not declared in any Angular module'. Maybe it is tslint or something else ?

2

the SCAM architecture pattern

Although I'm working with Angular for years, that's the first time that I hear the expression "SCAM." It sounds funny but interesting :)
What I love the most about standalone components is that I'm no more forced to create a module for shared components.

7

great !

1