Generating Standalone Angular Components

Ole Ersoy
May 25, 2023

--

Image by Pexels from Pixabay

Scenario

We wish to generate a standalone CustomerComponent using the Angular CLI.

Approach

ng g component --standalone Customer

To generate all components with the standalone flag without having to specify it update angular.json .

"schematics": {
"@schematics/angular:component": {
"standalone": true
}
}

This also works for directive and pipe schematics.

--

--

Ole Ersoy
Ole Ersoy

Written by Ole Ersoy

Founder of Firefly Semantics Corporation

No responses yet