Skip to content

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

Closed

Description

@preethamvishy

馃殌 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.

Activity

  1. added this to the Backlog milestone on Sep 25, 2019
  2. added
    help wantedLabel noting an issue which the team is looking for contribution from the community to fix
    on Nov 4, 2019
  3. added 3 commits that reference this issue on Nov 14, 2019
    686619f
    e59368e
    2a53e03
  4. added 2 commits that reference this issue on Nov 14, 2019
    2fc3fab
    eae7a27
  5. angular-automatic-lock-bot commented on Dec 15, 2019

    @angular-automatic-lock-bot

    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.

  6. locked and limited conversation to collaborators on Dec 15, 2019
  7. added a commit that references this issue on May 29, 2026
    8a60bed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @schematics/angularfeatureLabel used to distinguish feature request from other issueshelp wantedLabel noting an issue which the team is looking for contribution from the community to fix

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions