CLI

generate guard

Command
ng generate guard
ng generate g

Generates a new, generic route guard definition in the given project.

Arguments

name

The name of the new route guard.

Value Typestring

Options

flat

When true (the default), creates the new files at the top level of the current project.

Value TypebooleanDefaulttrue
functional

Specifies whether to generate a guard as a function.

Value TypebooleanDefaulttrue
implements
AliasguardType

Specifies which type of guard to create.

Value Typearray
project

The name of the project.

Value Typestring
skip-tests

Do not create "spec.ts" test files for the new guard.

Value TypebooleanDefaultfalse
Jump to details