Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to implement CanDeactivate interface while generating a guard #15668

Closed
preethamvishy opened this issue Sep 25, 2019 · 1 comment · Fixed by #16195
Closed

Add option to implement CanDeactivate interface while generating a guard #15668

preethamvishy opened this issue Sep 25, 2019 · 1 comment · Fixed by #16195
Labels
Milestone

Comments

@preethamvishy
Copy link

🚀 Feature request

Request to add option to implement CanDeactivate interface while generating a guard using ng generate.

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [x] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Description

The CLI has a nice selection option and schematics to implement CanActivate, CanActivateChild, CanLoad interfaces while generating a new guard. While I understand that it is not as straightforward as the others, it would be nice to have the option to implement the CanDeactivate interface as well.

Describe the solution you'd like

It would be nice to have a flag to indicate the component for which we want to implement the CanDeactivate interface for while generating it. Generate the guard for the component and update the component to add a generic canDeactivate() method similar to how we auto-update a module when a new component is created under it.

@alan-agius4 alan-agius4 added area: @schematics/angular feature Issue that requests a new feature labels Sep 25, 2019
@ngbot ngbot bot added this to the Backlog milestone Sep 25, 2019
cexbrayat added a commit to cexbrayat/angular-cli that referenced this issue Nov 14, 2019
This generates a generic `CanDeactivate<T>` guard.

Fixes angular#15668
cexbrayat added a commit to cexbrayat/angular-cli that referenced this issue Nov 14, 2019
This generates a generic `CanDeactivate<any>` guard.

Fixes angular#15668
cexbrayat added a commit to cexbrayat/angular-cli that referenced this issue Nov 14, 2019
This generates a generic `CanDeactivate<unknown>` guard.

Fixes angular#15668
dgp1130 pushed a commit that referenced this issue Nov 14, 2019
This generates a generic `CanDeactivate<unknown>` guard.

Fixes #15668
dgp1130 pushed a commit that referenced this issue Nov 14, 2019
This generates a generic `CanDeactivate<unknown>` guard.

Fixes #15668

(cherry picked from commit 2fc3fab)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants