generate directive
Command
ng generate directive
ng generate d
Creates a new, generic directive definition in the given project.
Arguments
name
The name of the new directive.
Value Type
string
Options
export
The declaring NgModule exports this directive.
Value Type
boolean
Defaultfalse
flat
When true (the default), creates the new files at the top level of the current project.
Value Type
boolean
Defaulttrue
module
Alias
m
The declaring NgModule.
Value Type
string
prefix
Alias
p
A prefix to apply to generated selectors.
Value Type
string
project
The name of the project.
Value Type
string
selector
The HTML selector to use for this directive.
Value Type
string
skip-import
Do not import this directive into the owning NgModule.
Value Type
boolean
Defaultfalse
skip-tests
Do not create "spec.ts" test files for the new class.
Value Type
boolean
Defaultfalse
standalone
Whether the generated directive is standalone.
Value Type
boolean
Defaulttrue
Jump to details