5 lines
8.0 KiB
JSON
5 lines
8.0 KiB
JSON
|
{
|
||
|
"id": "api/router/RouterStateSnapshot",
|
||
|
"title": "RouterStateSnapshot",
|
||
|
"contents": "\n\n<article>\n <div class=\"breadcrumb-container\">\n <div class=\"breadcrumb\">\n <script type=\"application/ld+json\">\n {\n \"@context\": \"http://schema.org\",\n \"@type\": \"BreadcrumbList\",\n \"itemListElement\": [\n { \"@type\": \"ListItem\", \"position\": 1, \"item\": { \"@id\": \"https://angular.io//api\", \"name\": \"API\" } },\n { \"@type\": \"ListItem\", \"position\": 2, \"item\": { \"@id\": \"https://angular.io/api/router\", \"name\": \"@angular/router\" } },\n { \"@type\": \"ListItem\", \"position\": 3, \"item\": { \"@id\": \"https://angular.io/api/router/RouterStateSnapshot\", \"name\": \"RouterStateSnapshot\" } }\n ]\n }\n </script>\n <a href=\"/api\">API</a> > <a href=\"api/router\">@angular/router</a>\n </div>\n <div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/packages/router/src/router_state.ts?message=docs(router)%3A%20describe%20your%20change...#L383-L423\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n <a href=\"https://github.com/angular/angular/tree/12.0.0-next.7/packages/router/src/router_state.ts#L383-L423\" aria-label=\"View Source\" title=\"View Source\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">code</i></a>\n</div>\n </div>\n \n <header class=\"api-header\">\n <h1 id=\"routerstatesnapshot\">RouterStateSnapshot<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/router/RouterStateSnapshot#routerstatesnapshot\"><i class=\"material-icons\">link</i></a></h1>\n \n <label class=\"api-type-label interface\">interface</label>\n \n \n \n </header>\n \n <aio-toc class=\"embedded\"></aio-toc>\n\n <div class=\"api-body\">\n \n <section class=\"short-description\">\n <p>Represents the state of the router at a moment in time.</p>\n\n <p><a href=\"api/router/RouterStateSnapshot#description\">See more...</a></p>\n </section>\n \n \n <section class=\"interface-overview\">\n<code-example language=\"ts\" hidecopy=\"true\">\ninterface <a href=\"api/router/RouterStateSnapshot\" class=\"code-anchor\">RouterStateSnapshot</a> extends Tree<activatedroutesnapshot> {\n <a class=\"code-anchor\" href=\"api/router/RouterStateSnapshot#url\"><span class=\"member-name\">url</span>: string</a>\n <a class=\"code-anchor\" href=\"api/router/RouterStateSnapshot#toString\"><span class=\"member-name\">toString</span>(): string</a>\n}\n</activatedroutesnapshot></code-example>\n\n \n \n\n\n \n \n\n</section>\n\n \n\n \n \n<section class=\"description\">\n <h2 id=\"description\">Description<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/router/RouterStateSnapshot#description\"><i class=\"material-icons\">link</i></a></h2>\n <p>This is a tree of activated route snapshots. Every node in this tree knows about\nthe \"consumed\" URL segments, the extracted parameters, and the resolved data.</p>\n<p>The following example shows how a component is initialized with information\nfrom the snapshot of the root node's state at the time of creation.</p>\n<code-example>\n@<a href=\"api/core/Component\" class=\"code-anchor\">Component</a>({templateUrl:'template.html'})\nclass MyComponent {\n constructor(router: <a href=\"api/router/Router\" class=\"code-anchor\">Router</a>) {\n const <a href=\"api/animations/state\" class=\"code-anchor\">state</a>: <a href=\"api/router/RouterState\" class=\"code-anchor\">RouterState</a> = router.routerState;\n const snapshot: <a href=\"api/router/RouterStateSnapshot\" class=\"code-anchor\">RouterStateSnapshot</a> = state.snapshot;\n const root: <a href=\"api/router/ActivatedRouteSnapshot\" class=\"code-anchor\">ActivatedRouteSnapshot</a> = snapshot.root;\n const child = root.firstChild;\n const id: Observable<string> = child.params.map(p => p.id);\n //...\n }\n}\n</code-example>\n\n \n</section>\n
|
||
|
}
|