Skip to content

Run runGuardsAndResolvers within injection context of the Route its part of #53944

Closed

Description

@Erbenos

Which @angular/* package(s) are relevant/related to the feature request?

router

Description

Would make implementation of non-trivial strategies simpler. Example of non-trivial strategy is one that would return true when current navigation contains specific "state" state, see #31843 (comment), this would be step forward to making on-demand resolver resolution less hackish. Right now it only receives from/to route snapshots as args which may not be sufficient for some use cases. Especially considering that routeConfig already contains many properties which accept functions such as guards or resolvers that do run within injection context which lets one use inject to access the DI, it seems sensible to me to expand the list to include the runGuardsAndResolvers.

Would be willing to give my shot at the implementation.

Proposed solution

Run runGuardsAndResolvers within injection context of the routeConfig its part of.

Alternatives considered

Manage route specific references to injectors manually via APP_INITIALIZER or ENVIRONMENT_INITIALIZER.

Activity

  1. changed the title [-]Run runGuardsAndResolvers within injection context of the routeConfig its part of[/-] [+]Run runGuardsAndResolvers within injection context of the RouteConfig its part of[/+] on Jan 16, 2024
  2. changed the title [-]Run runGuardsAndResolvers within injection context of the RouteConfig its part of[/-] [+]Run runGuardsAndResolvers within injection context of the Route its part of[/+] on Jan 16, 2024
  3. added
    feature
    on Jan 16, 2024
  4. modified the milestone: Backlog on Jan 16, 2024
  5. angular-robot commented on Jan 17, 2024

    @angular-robot
    Contributor

    This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.

    You can find more details about the feature request process in our documentation.

  6. Erbenos commented on Nov 12, 2025

    @Erbenos
    ContributorAuthor

    Sorry, I must have got it confused with different PR. Thanks!

  7. angular-automatic-lock-bot commented on Dec 21, 2025

    @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.

  8. locked and limited conversation to collaborators on Dec 21, 2025
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: routerfeature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions