Angular 9 References/ CLI
References

Guard generator

This is the documentation for Angular 9.
You can switch to the latest version Angular 10.
ng generate guard [name] [--[argument]=[value]]
ng generate g

Create a guard.

Options

--flat#

Flag to indicate if a dir is created.
Type boolean
Default true

--implements#

Specifies which interfaces to implement.
Type string
Values CanActivate|CanActivateChild|CanLoad

--lintFix#

Specifies whether to apply lint fixes after generating the guard.
Type boolean
Default false

--project#

The name of the project.
Type string

--skipTests#

When true, does not create `spec.ts` test files for the new guard.
Type boolean
Default false