Skip to content

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: routerfeatureLabel used to distinguish feature request from other issues

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions