Component generator

ng generate component [name] [--[argument]=[value]]
ng generate c

Create an Angular component.

Options

--changeDetection#

Specifies the change detection strategy.

Type string
Values Default, OnPush
Default Default
Aliases c

--export#

Specifies if declaring module exports the component.

Type boolean
Default false

--flat#

Flag to indicate if a dir is created.

Type boolean
Default false

--inlineStyle#

Specifies if the style will be in the ts file.

Type boolean
Default false
Aliases s

--inlineTemplate#

Specifies if the template will be in the ts file.

Type boolean
Default false
Aliases t

--lintFix#

Specifies whether to apply lint fixes after generating the component.

Type boolean
Default false

--module#

Allows specification of the declaring module.

Type string
Aliases m

--prefix#

The prefix to apply to generated selectors.

Type string
Aliases p

--project#

The name of the project.

Type string
Default projectName

--selector#

The selector to use for the component.

Type string

--skipImport#

When true, does not import this component into the owning NgModule.

Type boolean
Default false

--skipSelector#

Specifies if the component should have a selector or not.

Type boolean
Default false

--skipTests#

When true, does not create "spec.ts" test files for the new component.

Type boolean
Default false

--style#

The file extension to be used for style files.

Type string
Values css|scss|sass|less|styl
Default css

--type#

Adds a developer-defined type to the filename, in the format name.type.ts.

Type string
Default Component

--viewEncapsulation#

Specifies the view encapsulation strategy.

Type string
Values Emulated, Native, None
Default Emulated
Aliases v