Directive generator
This is the documentation for Angular 7.
You can switch to the
latest version Angular 10.
ng generate directive [name] [--[argument]=[value]]
ng generate d
Create an Angular directive.
Options
--export
#
Specifies if declaring module exports the directive. Type | boolean |
Default | false |
--flat
#
Flag to indicate if a dir is created. Type | boolean |
Default | true |
--lintFix
#
Specifies whether to apply lint fixes after generating the directive. Type | boolean |
Default | false |
--module
#
Allows specification of the declaring module. --prefix
#
The prefix to apply to generated selectors. --project
#
The name of the project. Type | string |
Default | projectName |
--selector
#
The selector to use for the directive. --skipImport
#
Flag to skip the module import. Type | boolean |
Default | false |
--spec
#
Specifies if a spec file is generated. Type | boolean |
Default | true |