(rootSegmentGroup: UrlSegmentGroup)
| 123 | } |
| 124 | |
| 125 | private async match(rootSegmentGroup: UrlSegmentGroup): Promise<{ |
| 126 | children: TreeNode<ActivatedRouteSnapshot>[]; |
| 127 | rootSnapshot: ActivatedRouteSnapshot; |
| 128 | }> { |
| 129 | // Use Object.freeze to prevent readers of the Router state from modifying it outside |
| 130 | // of a navigation, resulting in the router being out of sync with the browser. |
| 131 | const rootSnapshot = new ActivatedRouteSnapshot( |
| 132 | [], |
| 133 | Object.freeze({}), |
| 134 | this.queryParams, |
| 135 | this.urlTree.fragment, |
| 136 | Object.freeze({}), |
| 137 | PRIMARY_OUTLET, |
| 138 | this.rootComponentType, |
| 139 | null, |
| 140 | {}, |
| 141 | this.injector, |
| 142 | ); |
| 143 | const children = await this.processSegmentGroup( |
| 144 | this.injector, |
| 145 | this.config, |
| 146 | rootSegmentGroup, |
| 147 | PRIMARY_OUTLET, |
| 148 | rootSnapshot, |
| 149 | ); |
| 150 | if (children instanceof AbsoluteRedirect) { |
| 151 | // Count at the actual root-restart boundary so redirects returned from functions are |
| 152 | // subject to the same limit as static redirects. |
| 153 | this.absoluteRedirectCount++; |
| 154 | if (this.absoluteRedirectCount > MAX_ALLOWED_REDIRECTS) { |
| 155 | if (ngDevMode) { |
| 156 | throw new RuntimeError( |
| 157 | RuntimeErrorCode.INFINITE_REDIRECT, |
| 158 | `Detected possible infinite redirect when redirecting from '${this.urlTree}' to '${children.urlTree}'.`, |
| 159 | ); |
| 160 | } |
| 161 | this.allowRedirects = false; |
| 162 | } |
| 163 | this.urlTree = children.urlTree; |
| 164 | this.queryParams = Object.freeze({...this.urlTree.queryParams}); |
| 165 | return this.match(children.urlTree.root); |
| 166 | } |
| 167 | if (children instanceof NoMatch) { |
| 168 | throw this.noMatchError(children); |
| 169 | } |
| 170 | return {children, rootSnapshot}; |
| 171 | } |
| 172 | |
| 173 | async processSegmentGroup( |
| 174 | injector: EnvironmentInjector, |
no test coverage detected