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