ng generate

This is the documentation for Angular 6.
You can switch to the latest version Angular 7.
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#

Run through without making any changes.

Type boolean
Default false
Aliases d

force#

Forces overwriting of files.

Type boolean
Default false
Aliases f