ng generate
This is the documentation for Angular 7.
You can switch to the latest version Angular 10.
You can switch to the latest version Angular 10.
ng generate [schematic-name] [name] [--[argument]=[value]]
ng g
Generates the specified schematic.
Also Angular CLI provides a mechanism to generate code from any package (schematic-package
points to an npm package name):
ng generate [schematic-package]:[schematic-name] [name]
Configuration
The list of the default generators you can find in the section Schematics.
Default values of generators options can be added to your angular.json
file.
Also you can override any option on ng generate
command call:
ng run [project]:[target] --[argument]=[value]
Options
The next options can be applied to any generator.
--dryRun
#
Type | boolean |
Default | false |
Aliases | d |
--force
#
Type | boolean |
Default | false |
Aliases | f |