diff --git a/modules/@angular/router/src/create_router_state.ts b/modules/@angular/router/src/create_router_state.ts index c89c825a3b..eb39717ff1 100644 --- a/modules/@angular/router/src/create_router_state.ts +++ b/modules/@angular/router/src/create_router_state.ts @@ -13,9 +13,7 @@ import {TreeNode} from './utils/tree'; export function createRouterState(curr: RouterStateSnapshot, prevState: RouterState): RouterState { const root = createNode(curr._root, prevState ? prevState._root : undefined); - const queryParams = prevState ? prevState.queryParams : new BehaviorSubject(curr.queryParams); - const fragment = prevState ? prevState.fragment : new BehaviorSubject(curr.fragment); - return new RouterState(root, queryParams, fragment, curr); + return new RouterState(root, curr); } function createNode(curr: TreeNode, prevState?: TreeNode): @@ -48,8 +46,8 @@ function createOrReuseChildren( function createActivatedRoute(c: ActivatedRouteSnapshot) { return new ActivatedRoute( - new BehaviorSubject(c.url), new BehaviorSubject(c.params), new BehaviorSubject(c.data), - c.outlet, c.component, c); + new BehaviorSubject(c.url), new BehaviorSubject(c.params), new BehaviorSubject(c.queryParams), + new BehaviorSubject(c.fragment), new BehaviorSubject(c.data), c.outlet, c.component, c); } function equalRouteSnapshots(a: ActivatedRouteSnapshot, b: ActivatedRouteSnapshot): boolean { diff --git a/modules/@angular/router/src/recognize.ts b/modules/@angular/router/src/recognize.ts index 62630f0f74..3e76405467 100644 --- a/modules/@angular/router/src/recognize.ts +++ b/modules/@angular/router/src/recognize.ts @@ -40,47 +40,131 @@ class InheritedFromParent { export function recognize(rootComponentType: Type, config: Routes, urlTree: UrlTree, url: string): Observable { - try { - const rootSegmentGroup = split(urlTree.root, [], [], config).segmentGroup; - const children = processSegmentGroup( - config, rootSegmentGroup, InheritedFromParent.empty(null), PRIMARY_OUTLET); - const root = new ActivatedRouteSnapshot( - [], Object.freeze({}), {}, PRIMARY_OUTLET, rootComponentType, null, urlTree.root, -1, - InheritedResolve.empty); - const rootNode = new TreeNode(root, children); - return of (new RouterStateSnapshot( - url, rootNode, Object.freeze(urlTree.queryParams), urlTree.fragment)); - } catch (e) { - if (e instanceof NoMatch) { - return new Observable( - (obs: Observer) => - obs.error(new Error(`Cannot match any routes: '${e.segmentGroup}'`))); - } else { - return new Observable( - (obs: Observer) => obs.error(e)); + return new Recognizer(rootComponentType, config, urlTree, url).recognize(); +} + +class Recognizer { + constructor( + private rootComponentType: Type, private config: Routes, private urlTree: UrlTree, + private url: string) {} + + recognize(): Observable { + try { + const rootSegmentGroup = split(this.urlTree.root, [], [], this.config).segmentGroup; + + const children = this.processSegmentGroup( + this.config, rootSegmentGroup, InheritedFromParent.empty(null), PRIMARY_OUTLET); + + const root = new ActivatedRouteSnapshot( + [], Object.freeze({}), Object.freeze(this.urlTree.queryParams), this.urlTree.fragment, {}, + PRIMARY_OUTLET, this.rootComponentType, null, this.urlTree.root, -1, + InheritedResolve.empty); + + const rootNode = new TreeNode(root, children); + + return of (new RouterStateSnapshot(this.url, rootNode)); + + } catch (e) { + if (e instanceof NoMatch) { + return new Observable( + (obs: Observer) => + obs.error(new Error(`Cannot match any routes: '${e.segmentGroup}'`))); + } else { + return new Observable( + (obs: Observer) => obs.error(e)); + } } } -} -function processSegmentGroup( - config: Route[], segmentGroup: UrlSegmentGroup, inherited: InheritedFromParent, - outlet: string): TreeNode[] { - if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) { - return processChildren(config, segmentGroup, inherited); - } else { - return processSegment(config, segmentGroup, 0, segmentGroup.segments, inherited, outlet); + + processSegmentGroup( + config: Route[], segmentGroup: UrlSegmentGroup, inherited: InheritedFromParent, + outlet: string): TreeNode[] { + if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) { + return this.processChildren(config, segmentGroup, inherited); + } else { + return this.processSegment(config, segmentGroup, 0, segmentGroup.segments, inherited, outlet); + } } -} -function processChildren( - config: Route[], segmentGroup: UrlSegmentGroup, - inherited: InheritedFromParent): TreeNode[] { - const children = mapChildrenIntoArray( - segmentGroup, - (child, childOutlet) => processSegmentGroup(config, child, inherited, childOutlet)); - checkOutletNameUniqueness(children); - sortActivatedRouteSnapshots(children); - return children; + processChildren(config: Route[], segmentGroup: UrlSegmentGroup, inherited: InheritedFromParent): + TreeNode[] { + const children = mapChildrenIntoArray( + segmentGroup, + (child, childOutlet) => this.processSegmentGroup(config, child, inherited, childOutlet)); + checkOutletNameUniqueness(children); + sortActivatedRouteSnapshots(children); + return children; + } + + processSegment( + config: Route[], segmentGroup: UrlSegmentGroup, pathIndex: number, segments: UrlSegment[], + inherited: InheritedFromParent, outlet: string): TreeNode[] { + for (let r of config) { + try { + return this.processSegmentAgainstRoute( + r, segmentGroup, pathIndex, segments, inherited, outlet); + } catch (e) { + if (!(e instanceof NoMatch)) throw e; + } + } + throw new NoMatch(segmentGroup); + } + + processSegmentAgainstRoute( + route: Route, rawSegment: UrlSegmentGroup, pathIndex: number, segments: UrlSegment[], + inherited: InheritedFromParent, outlet: string): TreeNode[] { + if (route.redirectTo) throw new NoMatch(); + + if ((route.outlet ? route.outlet : PRIMARY_OUTLET) !== outlet) throw new NoMatch(); + + const newInheritedResolve = new InheritedResolve(inherited.resolve, getResolve(route)); + + if (route.path === '**') { + const params = segments.length > 0 ? last(segments).parameters : {}; + const snapshot = new ActivatedRouteSnapshot( + segments, Object.freeze(merge(inherited.allParams, params)), + Object.freeze(this.urlTree.queryParams), this.urlTree.fragment, + merge(inherited.allData, getData(route)), outlet, route.component, route, + getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + segments.length, + newInheritedResolve); + return [new TreeNode(snapshot, [])]; + } + + const {consumedSegments, parameters, lastChild} = + match(rawSegment, route, segments, inherited.snapshot); + const rawSlicedSegments = segments.slice(lastChild); + const childConfig = getChildConfig(route); + + const {segmentGroup, slicedSegments} = + split(rawSegment, consumedSegments, rawSlicedSegments, childConfig); + + const snapshot = new ActivatedRouteSnapshot( + consumedSegments, Object.freeze(merge(inherited.allParams, parameters)), + Object.freeze(this.urlTree.queryParams), this.urlTree.fragment, + merge(inherited.allData, getData(route)), outlet, route.component, route, + getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + consumedSegments.length, + newInheritedResolve); + + const newInherited = route.component ? + InheritedFromParent.empty(snapshot) : + new InheritedFromParent( + inherited, snapshot, parameters, getData(route), newInheritedResolve); + + if (slicedSegments.length === 0 && segmentGroup.hasChildren()) { + const children = this.processChildren(childConfig, segmentGroup, newInherited); + return [new TreeNode(snapshot, children)]; + + } else if (childConfig.length === 0 && slicedSegments.length === 0) { + return [new TreeNode(snapshot, [])]; + + } else { + const children = this.processSegment( + childConfig, segmentGroup, pathIndex + lastChild, slicedSegments, newInherited, + PRIMARY_OUTLET); + return [new TreeNode(snapshot, children)]; + } + } } function sortActivatedRouteSnapshots(nodes: TreeNode[]): void { @@ -91,71 +175,6 @@ function sortActivatedRouteSnapshots(nodes: TreeNode[]): }); } -function processSegment( - config: Route[], segmentGroup: UrlSegmentGroup, pathIndex: number, segments: UrlSegment[], - inherited: InheritedFromParent, outlet: string): TreeNode[] { - for (let r of config) { - try { - return processSegmentAgainstRoute(r, segmentGroup, pathIndex, segments, inherited, outlet); - } catch (e) { - if (!(e instanceof NoMatch)) throw e; - } - } - throw new NoMatch(segmentGroup); -} - -function processSegmentAgainstRoute( - route: Route, rawSegment: UrlSegmentGroup, pathIndex: number, segments: UrlSegment[], - inherited: InheritedFromParent, outlet: string): TreeNode[] { - if (route.redirectTo) throw new NoMatch(); - - if ((route.outlet ? route.outlet : PRIMARY_OUTLET) !== outlet) throw new NoMatch(); - - const newInheritedResolve = new InheritedResolve(inherited.resolve, getResolve(route)); - - if (route.path === '**') { - const params = segments.length > 0 ? last(segments).parameters : {}; - const snapshot = new ActivatedRouteSnapshot( - segments, Object.freeze(merge(inherited.allParams, params)), - merge(inherited.allData, getData(route)), outlet, route.component, route, - getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + segments.length, - newInheritedResolve); - return [new TreeNode(snapshot, [])]; - } - - const {consumedSegments, parameters, lastChild} = - match(rawSegment, route, segments, inherited.snapshot); - const rawSlicedSegments = segments.slice(lastChild); - const childConfig = getChildConfig(route); - - const {segmentGroup, slicedSegments} = - split(rawSegment, consumedSegments, rawSlicedSegments, childConfig); - - const snapshot = new ActivatedRouteSnapshot( - consumedSegments, Object.freeze(merge(inherited.allParams, parameters)), - merge(inherited.allData, getData(route)), outlet, route.component, route, - getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + consumedSegments.length, - newInheritedResolve); - - const newInherited = route.component ? - InheritedFromParent.empty(snapshot) : - new InheritedFromParent(inherited, snapshot, parameters, getData(route), newInheritedResolve); - - if (slicedSegments.length === 0 && segmentGroup.hasChildren()) { - const children = processChildren(childConfig, segmentGroup, newInherited); - return [new TreeNode(snapshot, children)]; - - } else if (childConfig.length === 0 && slicedSegments.length === 0) { - return [new TreeNode(snapshot, [])]; - - } else { - const children = processSegment( - childConfig, segmentGroup, pathIndex + lastChild, slicedSegments, newInherited, - PRIMARY_OUTLET); - return [new TreeNode(snapshot, children)]; - } -} - function getChildConfig(route: Route): Route[] { if (route.children) { return route.children; diff --git a/modules/@angular/router/src/router.ts b/modules/@angular/router/src/router.ts index 9ca2f6d37f..7258fcddfb 100644 --- a/modules/@angular/router/src/router.ts +++ b/modules/@angular/router/src/router.ts @@ -649,7 +649,6 @@ class ActivateRoutes { const currRoot = this.currState ? this.currState._root : null; advanceActivatedRoute(this.futureState.root); this.activateChildRoutes(futureRoot, currRoot, parentOutletMap); - pushQueryParamsAndFragment(this.futureState); } private activateChildRoutes( @@ -758,16 +757,6 @@ function closestLoadedConfig( return b.length > 0 ? (b[b.length - 1])._routeConfig._loadedConfig : null; } -function pushQueryParamsAndFragment(state: RouterState): void { - if (!shallowEqual(state.snapshot.queryParams, (state.queryParams).value)) { - (state.queryParams).next(state.snapshot.queryParams); - } - - if (state.snapshot.fragment !== (state.fragment).value) { - (state.fragment).next(state.snapshot.fragment); - } -} - function nodeChildrenAsMap(node: TreeNode) { return node ? node.children.reduce((m: any, c: TreeNode) => { m[c.value.outlet] = c; diff --git a/modules/@angular/router/src/router_state.ts b/modules/@angular/router/src/router_state.ts index 383595cbbc..d8ae83bfef 100644 --- a/modules/@angular/router/src/router_state.ts +++ b/modules/@angular/router/src/router_state.ts @@ -38,13 +38,21 @@ export class RouterState extends Tree { /** * @internal */ - constructor( - root: TreeNode, public queryParams: Observable, - public fragment: Observable, public snapshot: RouterStateSnapshot) { + constructor(root: TreeNode, public snapshot: RouterStateSnapshot) { super(root); setRouterStateSnapshot(this, root); } + /** + * @deprecated (Use root.queryParams) + */ + get queryParams(): Observable { return this.root.queryParams; } + + /** + * @deprecated (Use root.fragment) + */ + get fragment(): Observable { return this.root.fragment; } + toString(): string { return this.snapshot.toString(); } } @@ -56,10 +64,10 @@ export function createEmptyState(urlTree: UrlTree, rootComponent: Type): RouterS const emptyQueryParams = new BehaviorSubject({}); const fragment = new BehaviorSubject(''); const activated = new ActivatedRoute( - emptyUrl, emptyParams, emptyData, PRIMARY_OUTLET, rootComponent, snapshot.root); + emptyUrl, emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, + snapshot.root); activated.snapshot = snapshot.root; - return new RouterState( - new TreeNode(activated, []), emptyQueryParams, fragment, snapshot); + return new RouterState(new TreeNode(activated, []), snapshot); } function createEmptyStateSnapshot(urlTree: UrlTree, rootComponent: Type): RouterStateSnapshot { @@ -68,10 +76,9 @@ function createEmptyStateSnapshot(urlTree: UrlTree, rootComponent: Type): Router const emptyQueryParams = {}; const fragment = ''; const activated = new ActivatedRouteSnapshot( - [], emptyParams, emptyData, PRIMARY_OUTLET, rootComponent, null, urlTree.root, -1, - InheritedResolve.empty); - return new RouterStateSnapshot( - '', new TreeNode(activated, []), emptyQueryParams, fragment); + [], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, + urlTree.root, -1, InheritedResolve.empty); + return new RouterStateSnapshot('', new TreeNode(activated, [])); } /** @@ -104,6 +111,7 @@ export class ActivatedRoute { */ constructor( public url: Observable, public params: Observable, + public queryParams: Observable, public fragment: Observable, public data: Observable, public outlet: string, public component: Type|string, futureSnapshot: ActivatedRouteSnapshot) { this._futureSnapshot = futureSnapshot; @@ -187,7 +195,8 @@ export class ActivatedRouteSnapshot { * @internal */ constructor( - public url: UrlSegment[], public params: Params, public data: Data, public outlet: string, + public url: UrlSegment[], public params: Params, public queryParams: Params, + public fragment: string, public data: Data, public outlet: string, public component: Type|string, routeConfig: Route, urlSegment: UrlSegmentGroup, lastPathIndex: number, resolve: InheritedResolve) { this._routeConfig = routeConfig; @@ -232,13 +241,21 @@ export class RouterStateSnapshot extends Tree { /** * @internal */ - constructor( - public url: string, root: TreeNode, public queryParams: Params, - public fragment: string) { + constructor(public url: string, root: TreeNode) { super(root); setRouterStateSnapshot(this, root); } + /** + * @deprecated (Use root.queryParams) + */ + get queryParams(): Params { return this.root.queryParams; } + + /** + * @deprecated (Use root.fragment) + */ + get fragment(): string { return this.root.fragment; } + toString(): string { return serializeNode(this._root); } } @@ -259,6 +276,12 @@ function serializeNode(node: TreeNode): string { */ export function advanceActivatedRoute(route: ActivatedRoute): void { if (route.snapshot) { + if (!shallowEqual(route.snapshot.queryParams, route._futureSnapshot.queryParams)) { + (route.queryParams).next(route._futureSnapshot.queryParams); + } + if (route.snapshot.fragment !== route._futureSnapshot.fragment) { + (route.fragment).next(route._futureSnapshot.fragment); + } if (!shallowEqual(route.snapshot.params, route._futureSnapshot.params)) { (route.params).next(route._futureSnapshot.params); (route.data).next(route._futureSnapshot.data); @@ -269,6 +292,8 @@ export function advanceActivatedRoute(route: ActivatedRoute): void { route.snapshot = route._futureSnapshot; } else { route.snapshot = route._futureSnapshot; + + // this is for resolved data (route.data).next(route._futureSnapshot.data); } } diff --git a/modules/@angular/router/test/create_url_tree.spec.ts b/modules/@angular/router/test/create_url_tree.spec.ts index 3e2a753960..b9da704efb 100644 --- a/modules/@angular/router/test/create_url_tree.spec.ts +++ b/modules/@angular/router/test/create_url_tree.spec.ts @@ -200,10 +200,11 @@ describe('createUrlTree', () => { function createRoot(tree: UrlTree, commands: any[], queryParams?: Params, fragment?: string) { const s = new ActivatedRouteSnapshot( - [], {}, {}, PRIMARY_OUTLET, 'someComponent', null, tree.root, -1, null); + [], {}, {}, '', {}, PRIMARY_OUTLET, 'someComponent', null, tree.root, -1, + null); const a = new ActivatedRoute( new BehaviorSubject(null), new BehaviorSubject(null), new BehaviorSubject(null), - PRIMARY_OUTLET, 'someComponent', s); + new BehaviorSubject(null), new BehaviorSubject(null), PRIMARY_OUTLET, 'someComponent', s); advanceActivatedRoute(a); return createUrlTree(a, tree, commands, queryParams, fragment); } @@ -215,11 +216,11 @@ function create( expect(segment).toBeDefined(); } const s = new ActivatedRouteSnapshot( - [], {}, {}, PRIMARY_OUTLET, 'someComponent', null, segment, startIndex, - null); + [], {}, {}, '', {}, PRIMARY_OUTLET, 'someComponent', null, segment, + startIndex, null); const a = new ActivatedRoute( new BehaviorSubject(null), new BehaviorSubject(null), new BehaviorSubject(null), - PRIMARY_OUTLET, 'someComponent', s); + new BehaviorSubject(null), new BehaviorSubject(null), PRIMARY_OUTLET, 'someComponent', s); advanceActivatedRoute(a); return createUrlTree(a, tree, commands, queryParams, fragment); } \ No newline at end of file diff --git a/modules/@angular/router/test/router.spec.ts b/modules/@angular/router/test/router.spec.ts index 2fb29c3e98..6f3833e51f 100644 --- a/modules/@angular/router/test/router.spec.ts +++ b/modules/@angular/router/test/router.spec.ts @@ -28,7 +28,7 @@ describe('Integration', () => { BlankCmp, SimpleCmp, TeamCmp, UserCmp, StringLinkCmp, DummyLinkCmp, AbsoluteLinkCmp, RelativeLinkCmp, DummyLinkWithParentCmp, LinkWithQueryParamsAndFragment, CollectParamsCmp, QueryParamsAndFragmentCmp, StringLinkButtonCmp, WrapperCmp, LinkInNgIf, - ComponentRecordingQueryParams, ComponentRecordingRoutePathAndUrl, RouteCmp + ComponentRecordingRoutePathAndUrl, RouteCmp ] }); }); @@ -289,29 +289,6 @@ describe('Integration', () => { expect(fixture.debugElement.nativeElement).toHaveText('query: 2 fragment: fragment2'); }))); - it('should not push query params into components that will be deactivated', - fakeAsync( - inject([Router, TestComponentBuilder], (router: Router, tcb: TestComponentBuilder) => { - - router.resetConfig([ - {path: '', component: ComponentRecordingQueryParams}, - {path: 'simple', component: SimpleCmp} - ]); - - const fixture = createRoot(tcb, router, RootCmp); - router.navigateByUrl('/?a=v1'); - advance(fixture); - - const c = fixture.debugElement.children[1].componentInstance; - - expect(c.recordedQueryParams).toEqual([{}, {a: 'v1'}]); - - router.navigateByUrl('/simple?a=v2'); - advance(fixture); - - expect(c.recordedQueryParams).toEqual([{}, {a: 'v1'}]); - }))); - it('should push params only when they change', fakeAsync( inject([Router, TestComponentBuilder], (router: Router, tcb: TestComponentBuilder) => { @@ -1733,18 +1710,6 @@ class DummyLinkWithParentCmp { constructor(route: ActivatedRoute) { this.exact = (route.snapshot.params).exact === 'true'; } } - -@Component({template: ''}) -class ComponentRecordingQueryParams { - recordedQueryParams: any[] = []; - subscription: any; - constructor(r: Router) { - this.subscription = r.routerState.queryParams.subscribe(r => this.recordedQueryParams.push(r)); - } - - ngOnDestroy() { this.subscription.unsubscribe(); } -} - @Component({selector: 'cmp', template: ''}) class ComponentRecordingRoutePathAndUrl { private path: any; @@ -1764,7 +1729,7 @@ class ComponentRecordingRoutePathAndUrl { BlankCmp, SimpleCmp, TeamCmp, UserCmp, StringLinkCmp, DummyLinkCmp, AbsoluteLinkCmp, RelativeLinkCmp, DummyLinkWithParentCmp, LinkWithQueryParamsAndFragment, CollectParamsCmp, QueryParamsAndFragmentCmp, StringLinkButtonCmp, WrapperCmp, LinkInNgIf, - ComponentRecordingQueryParams, ComponentRecordingRoutePathAndUrl + ComponentRecordingRoutePathAndUrl ] }) class RootCmp { diff --git a/modules/@angular/router/test/router_state.spec.ts b/modules/@angular/router/test/router_state.spec.ts index f7180bf61b..91a7d248eb 100644 --- a/modules/@angular/router/test/router_state.spec.ts +++ b/modules/@angular/router/test/router_state.spec.ts @@ -23,7 +23,7 @@ describe('RouterState & Snapshot', () => { const root = new TreeNode(a, [new TreeNode(b, []), new TreeNode(c, [])]); - state = new RouterStateSnapshot('url', root, {}, ''); + state = new RouterStateSnapshot('url', root); }); it('should return first child', () => { expect(state.root.firstChild).toBe(b); }); @@ -60,7 +60,7 @@ describe('RouterState & Snapshot', () => { const root = new TreeNode(a, [new TreeNode(b, []), new TreeNode(c, [])]); - state = new RouterState(root, null, null, null); + state = new RouterState(root, null); }); it('should return first child', () => { expect(state.root.firstChild).toBe(b); }); @@ -87,9 +87,11 @@ describe('RouterState & Snapshot', () => { function createActivatedRouteSnapshot(cmp: string) { return new ActivatedRouteSnapshot( - null, null, null, null, cmp, null, null, -1, null); + null, null, null, null, null, null, cmp, null, + null, -1, null); } function createActivatedRoute(cmp: string) { - return new ActivatedRoute(null, null, null, null, cmp, null); + return new ActivatedRoute( + null, null, null, null, null, null, cmp, null); } diff --git a/tools/public_api_guard/router/index.d.ts b/tools/public_api_guard/router/index.d.ts index cb9ac236d8..6ee3758afd 100644 --- a/tools/public_api_guard/router/index.d.ts +++ b/tools/public_api_guard/router/index.d.ts @@ -1,9 +1,15 @@ /** @stable */ export declare class ActivatedRoute { + children: ActivatedRoute[]; component: Type | string; data: Observable; + firstChild: ActivatedRoute; + fragment: Observable; outlet: string; params: Observable; + parent: ActivatedRoute; + pathFromRoot: ActivatedRoute[]; + queryParams: Observable; routeConfig: Route; snapshot: ActivatedRouteSnapshot; url: Observable; @@ -12,10 +18,16 @@ export declare class ActivatedRoute { /** @stable */ export declare class ActivatedRouteSnapshot { + children: ActivatedRouteSnapshot[]; component: Type | string; data: Data; + firstChild: ActivatedRouteSnapshot; + fragment: string; outlet: string; params: Params; + parent: ActivatedRouteSnapshot; + pathFromRoot: ActivatedRouteSnapshot[]; + queryParams: Params; routeConfig: Route; url: UrlSegment[]; toString(): string; @@ -249,16 +261,16 @@ export declare class RouterOutletMap { /** @stable */ export declare class RouterState extends Tree { - fragment: Observable; - queryParams: Observable; + /** @deprecated */ fragment: Observable; + /** @deprecated */ queryParams: Observable; snapshot: RouterStateSnapshot; toString(): string; } /** @stable */ export declare class RouterStateSnapshot extends Tree { - fragment: string; - queryParams: Params; + /** @deprecated */ fragment: string; + /** @deprecated */ queryParams: Params; url: string; toString(): string; }