Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upgenerate component
Documentation below is for CLI version 6. For version 7 see here.
ng generate component
Overview
ng generate component [name]
generates a component
Alias
c - ng generate c [name]
Options
dry-run
--dry-run
(alias: -d
)
Run through without making any changes.
force
--force
(alias: -f
)
Forces overwriting of files.
project
--project
The name of the project.
inline-style
--inline-style
(alias: -s
)
Specifies if the style will be in the ts file.
inline-template
--inline-template
(alias: -t
)
Specifies if the template will be in the ts file.
view-encapsulation
--view-encapsulation
(alias: -v
)
Specifies the view encapsulation strategy.
change-detection
--change-detection
(alias: -c
)
Specifies the change detection strategy.
prefix
--prefix
(alias: -p
)
The prefix to apply to generated selectors.
styleext
--styleext
The file extension to be used for style files.
spec
--spec
Specifies if a spec file is generated.
flat
--flat
Flag to indicate if a dir is created.
skip-import
--skip-import
Flag to skip the module import.
selector
--selector
The selector to use for the component.
module
--module
(alias: -m
)
Allows specification of the declaring module.
export
--export
Specifies if declaring module exports the component.