Skip to content

Latest commit

 

History

History
83 lines (47 loc) · 5.73 KB

File metadata and controls

83 lines (47 loc) · 5.73 KB
graph LR
    Recognizer["Recognizer"]
    RouteMatcher["RouteMatcher"]
    ChildRouteProcessor["ChildRouteProcessor"]
    RouteRedirector["RouteRedirector"]
    PathMatcher["PathMatcher"]
    RouteResolutionUtilities["RouteResolutionUtilities"]
    Recognizer -- "calls" --> RouteMatcher
    RouteMatcher -- "delegates to" --> ChildRouteProcessor
    RouteMatcher -- "utilizes" --> PathMatcher
    RouteMatcher -- "delegates to" --> RouteRedirector
    RouteRedirector -- "returns control to" --> RouteMatcher
    ChildRouteProcessor -- "recursively calls" --> RouteMatcher
    ChildRouteProcessor -- "utilizes" --> RouteResolutionUtilities
Loading

CodeBoardingDemoContact

Details

The Angular Router's recognition subsystem, orchestrated by the Recognizer, is responsible for transforming a UrlTree into an ActivatedRouteSnapshot hierarchy. The RouteMatcher component, central to this process, recursively traverses the URL segments and route configurations, delegating to specialized components for specific matching and processing tasks. The ChildRouteProcessor handles the recursive matching and integration of child routes, ensuring proper handling of nested configurations and outlet names. During this process, the RouteRedirector manages any route redirections, while the PathMatcher performs the atomic comparison of URL segments against defined route paths. Finally, RouteResolutionUtilities assist in consolidating and validating the resolved route hierarchy, particularly for empty path matches and outlet uniqueness. This collaborative structure ensures a robust and accurate route recognition process.

Recognizer

The top-level orchestrator and entry point for the entire route recognition process. It initiates the matching of a UrlTree against the application's configured route definitions.

Related Classes/Methods:

RouteMatcher

Encapsulates the core recursive algorithm for traversing the route tree. It systematically matches URL segments and groups (UrlSegmentGroup) against route configurations, driving the depth-first search through the defined routes. This component combines the responsibilities of the match, processSegmentGroup, and processSegment methods within the Recognizer class.

Related Classes/Methods:

ChildRouteProcessor

Manages the recursive processing and integration of child route configurations. It ensures that nested routes are correctly matched and integrated into the activated route hierarchy, handling aspects like outlet names and empty path routes. This component corresponds to the processChildren method within the Recognizer class.

Related Classes/Methods:

RouteRedirector

Handles the application of redirect logic for routes that have a redirectTo property. It validates the redirect target and ensures the routing process continues correctly after a redirection. This component corresponds to the expandSegmentAgainstRouteUsingRedirect function, which is used by the ApplyRedirects class.

Related Classes/Methods:

PathMatcher

Performs the direct comparison of a URL segment against a route's defined path. This includes handling path parameters and wildcards, serving as the atomic unit for segment-to-path matching. This component corresponds to the matchSegmentAgainstRoute function.

Related Classes/Methods:

RouteResolutionUtilities

Provides utility functions crucial for resolving the final activated route hierarchy. This includes correctly handling and merging routes with an empty path and ensuring that outlet names within the same level of the route hierarchy are unique to prevent conflicts. This component combines the responsibilities of the mergeEmptyPathMatches and checkOutletNameUniqueness functions.

Related Classes/Methods: