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