ng generate
ng generate [schematic] [name] [--[option]=[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.
Links & Tutorials
Options
The next options can be applied to any generator.
--defaults
#
When true, disables interactive input prompts for options with a default.
Type | boolean |
--dryRun
#
Run through without making any changes.
Type | boolean |
Default | false |
Aliases | -d |
--force
#
Forces overwriting of files.
Type | boolean |
Default | false |
Aliases | -f |
--help
#
Shows a help message for this command in the console.
Values | true|false|json|JSON |
Default | false |
--interactive
#
When false, disables interactive input prompts.
Type | boolean |