| 95 | } |
| 96 | |
| 97 | async recognize(): Promise<{state: RouterStateSnapshot; tree: UrlTree}> { |
| 98 | const rootSegmentGroup = split(this.urlTree.root, [], [], this.config).segmentGroup; |
| 99 | |
| 100 | const {children, rootSnapshot} = await this.match(rootSegmentGroup); |
| 101 | const rootNode = new TreeNode(rootSnapshot, children); |
| 102 | const routeState = new RouterStateSnapshot('', rootNode); |
| 103 | const tree = createUrlTreeFromSnapshot( |
| 104 | rootSnapshot, |
| 105 | [], |
| 106 | this.urlTree.queryParams, |
| 107 | this.urlTree.fragment, |
| 108 | ); |
| 109 | // Creating the tree stringifies the query params |
| 110 | // We don't want to do this here to preserve pre-existing behavior |
| 111 | // so reassign them to the original. |
| 112 | tree.queryParams = this.urlTree.queryParams; |
| 113 | routeState.url = this.urlSerializer.serialize(tree); |
| 114 | return {state: routeState, tree}; |
| 115 | } |
| 116 | |
| 117 | private async match(rootSegmentGroup: UrlSegmentGroup): Promise<{ |
| 118 | children: TreeNode<ActivatedRouteSnapshot>[]; |