@nx/angular:scam

Creates a new Angular SCAM.

Usage

1nx generate scam ... 2

By default, Nx will search for scam in the default collection provisioned in workspace.json.

You can specify the collection explicitly as follows:

1nx g @nx/angular:scam ... 2

Show what will be generated without writing to disk:

1nx g scam ... --dry-run 2

Examples

Generate a MySampleComponent component in the my-lib library.:

1nx g @nx/angular:scam my-sample --directory=my-lib/src/lib/my-sample 2

Options

name

Required
string

The name of the component.

directory

string

The directory at which to create the SCAM files. When --nameAndDirectoryFormat=as-provided, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.

export

boolean
Default: true

Specifies if the SCAM should be exported from the project's entry point (normally index.ts). It only applies to libraries.

inlineScam

boolean
Default: true

Create the NgModule in the same file as the component.

changeDetection

c
string
Default: Default
Accepted values: Default, OnPush

The change detection strategy to use in the new component.

displayBlock

b
boolean
Default: false

Specifies if the style will contain :host { display: block; }.

inlineStyle

s
boolean
Default: false

Include styles inline in the component.ts file. Only CSS styles can be included inline. By default, an external styles file is created and referenced in the component.ts file.

inlineTemplate

t
boolean
Default: false

Include template inline in the component.ts file. By default, an external template file is created and referenced in the component.ts file.

nameAndDirectoryFormat

string
Accepted values: as-provided, derived

Whether to generate the SCAM in the directory as provided, relative to the current working directory and ignoring the project (as-provided) or generate it using the project and directory relative to the workspace root (derived).

prefix

p
oneOf [string, string]

The prefix to apply to the generated component selector.

style

string
Default: css
Accepted values: css, scss, sass, less, none

The file extension or preprocessor to use for style files, or 'none' to skip generating the style file.

skipTests

boolean
Default: false

Do not create spec.ts test files for the new component.

selector

string
Format: html-selector

The HTML selector to use for this component.

skipSelector

boolean
Default: false

Specifies if the component should have a selector or not.

type

string
Default: component

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

viewEncapsulation

v
string
Accepted values: Emulated, None, ShadowDom

The view encapsulation strategy to use in the new component.

skipFormat

Internal
boolean
Default: false

Skip formatting files.

flat

Deprecated
boolean
Default: false

Create the new files at the top level of the current project.

Provide the directory option instead and use the as-provided format. It will be removed in Nx v20.

project

Deprecated
string

The name of the project.

Provide the directory option instead and use the as-provided format. The project will be determined from the directory provided. It will be removed in Nx v20.