Skip to content

Breaking Change: Add Guard Blueprints (target 2.0) #5337

Closed
@johnpapa

Description

@johnpapa

OS?

Mac OSX Sierra 10.12.3

Versions.

@angular/cli: 1.0.0-rc.1
node: 6.9.1
os: darwin x64
@angular/common: 2.4.9
@angular/compiler: 2.4.9
@angular/core: 2.4.9
@angular/forms: 2.4.9
@angular/http: 2.4.9
@angular/platform-browser: 2.4.9
@angular/platform-browser-dynamic: 2.4.9
@angular/router: 3.4.9
@angular/cli: 1.0.0-rc.1
@angular/compiler-cli: 2.4.9

Repro steps.

  1. ng g guard foo
  2. This generates a CanActivate guard

Proposal

Create a way to specify which type of guard to generate.

CanActivate guard - ng g guard-ca foo ...
CanActivateChild guard - ng g guard-cac foo
CanDeactivate guard - ng g guard-cd foo
CanLoad guard - ng g guard-cl foo
Resolve guard - ng g guard-r foo

The terms above are options. Others could be to pass a flag to the guard such as ...
ng g guard --type ca foo

Mention any other details that might be useful.

Currently there is only one type of guard folks can create from the CLI. This would be a breaking change as the current command is ambiguous and would likely need to change.

Due to it being a breaking change , this is best for v2.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions