5 lines
8.3 KiB
JSON
5 lines
8.3 KiB
JSON
{
|
|
"id": "api/router/RouterState",
|
|
"title": "RouterState",
|
|
"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/RouterState\", \"name\": \"RouterState\" } }\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...#L18-L65\" 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#L18-L65\" 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=\"routerstate\">RouterState<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/router/RouterState#routerstate\"><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 as a tree of activated routes.</p>\n\n \n </section>\n \n \n <section class=\"interface-overview\">\n<code-example language=\"ts\" hidecopy=\"true\">\ninterface <a href=\"api/router/RouterState\" class=\"code-anchor\">RouterState</a> extends Tree<activatedroute> {\n <a class=\"code-anchor\" href=\"api/router/RouterState#snapshot\"><span class=\"member-name\">snapshot</span>: RouterStateSnapshot</a>\n <a class=\"code-anchor\" href=\"api/router/RouterState#toString\"><span class=\"member-name\">toString</span>(): string</a>\n}\n</activatedroute></code-example>\n\n \n \n\n\n \n \n\n</section>\n\n \n<section class=\"see-also\">\n <h2 id=\"see-also\">See also<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/router/RouterState#see-also\"><i class=\"material-icons\">link</i></a></h2>\n <ul>\n \n <li><p><code><a href=\"api/router/ActivatedRoute\" class=\"code-anchor\">ActivatedRoute</a></code></p>\n</li>\n <li><p><a href=\"guide/router#getting-route-information\">Getting route information</a></p>\n</li>\n </ul>\n</section>\n\n\n \n \n \n<section class=\"instance-properties\">\n <h2 id=\"properties\">Properties<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/router/RouterState#properties\"><i class=\"material-icons\">link</i></a></h2>\n <table class=\"is-full-width list-table property-table\">\n <thead>\n <tr>\n <th>Property</th>\n <th>Description</th>\n </tr>\n </thead>\n <tbody>\n \n <tr class=\"instance-property\">\n <td>\n <a id=\"snapshot\"></a>\n <code class=\"\"><span class=\"member-name\">snapshot</span>: <a href=\"api/router/RouterStateSnapshot\" class=\"code-anchor\">RouterStateSnapshot</a></code>\n </td>\n <td>\n \n <p>The current snapshot of the router state</p>\n\n \n </td>\n </tr>\n \n </tbody>\n </table>\n</section>\n \n\n<section class=\"instance-methods\">\n <h2 id=\"methods\">Methods<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/router/RouterState#methods\"><i class=\"material-icons\">link</i></a></h2>\n \n <a id=\"toString\"></a>\n<table class=\"is-full-width method-table instance-method\">\n <thead><tr><th>\n <div class=\"with-github-links\">\n <h3 id=\"tostring\">\n toString()\n \n <a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/router/RouterState#tostring\"><i class=\"material-icons\">link</i></a></h3>\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...#L61-L64\" 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#L61-L64\" aria-label=\"View Source\" title=\"View Source\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">code</i></a>\n</div>\n </div>\n </th></tr></thead>\n <tbody>\n \n \n <tr>\n <td>\n <div class=\"overload-info\">\n \n\n <code-example language=\"ts\" hidecopy=\"true\" class=\"no-box api-heading\"><span class=\"member-name\">toString</span>(): string</code-example>\n\n \n\n <h6 class=\"no-anchor\" id=\"parameters\">Parameters</h6>\n <p>There are no parameters.</p>\n\n \n <h6 class=\"no-anchor\" id=\"returns\">Returns</h6>\n <p><code>string</code></p>\n\n \n\n\n \n\n \n</div>\n </td>\n </tr>\n \n\n \n\n \n </tbody>\n</table>\n\n \n</section>\n\n\n \n<section class=\"usage-notes\">\n <h2 id=\"usage-notes\">Usage notes<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/router/RouterState#usage-notes\"><i class=\"material-icons\">link</i></a></h2>\n <p>Every node in the route tree is an <code><a href=\"api/router/ActivatedRoute\" class=\"code-anchor\">ActivatedRoute</a></code> instance\nthat knows about the \"consumed\" URL segments, the extracted parameters,\nand the resolved data.\nUse the <code><a href=\"api/router/ActivatedRoute\" class=\"code-anchor\">ActivatedRoute</a></code> properties to traverse the tree from any node.</p>\n<p>The following fragment shows how a component gets the root node\nof the current state to establish its own route tree:</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 root: <a href=\"api/router/ActivatedRoute\" class=\"code-anchor\">ActivatedRoute</a> = state.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</section>\n\n\n\n </div>\n</article>\n\n<!-- links to this doc:\n - api/router\n - api/router/ActivatedRoute\n - api/router/ActivatedRouteSnapshot\n - api/router/Router\n - api/router/RouterStateSnapshot\n - guide/router\n - guide/router-tutorial-toh\n-->\n<!-- links from this doc:\n - /api\n - api/animations/state\n - api/core/Component\n - api/router\n - api/router/ActivatedRoute\n - api/router/Router\n - api/router/RouterState#methods\n - api/router/RouterState#properties\n - api/router/RouterState#routerstate\n - api/router/RouterState#see-also\n - api/router/RouterState#snapshot\n - api/router/RouterState#toString\n - api/router/RouterState#tostring\n - api/router/RouterState#usage-notes\n - api/router/RouterStateSnapshot\n - guide/router#getting-route-information\n - https://github.com/angular/angular/edit/master/packages/router/src/router_state.ts?message=docs(router)%3A%20describe%20your%20change...#L18-L65\n - https://github.com/angular/angular/edit/master/packages/router/src/router_state.ts?message=docs(router)%3A%20describe%20your%20change...#L61-L64\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/router/src/router_state.ts#L18-L65\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/router/src/router_state.ts#L61-L64\n-->"
|
|
} |