{
  "id": "api/core/global/ngGetContext",
  "title": "ng.getContext",
  "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/core\", \"name\": \"@angular/core\" } },\n            { \"@type\": \"ListItem\", \"position\": 3, \"item\": { \"@id\": \"https://angular.io/api/core/global\", \"name\": \"@angular/core/global\" } },\n            { \"@type\": \"ListItem\", \"position\": 4, \"item\": { \"@id\": \"https://angular.io/api/core/global/ngGetContext\", \"name\": \"ng.getContext\" } }\n          ]\n        }\n      </script>\n        <a href=\"/api\">API</a> > <a href=\"api/core\">@angular/core</a> > <a href=\"api/core/global\">@angular/core/global</a>\n    </div>\n    <div class=\"github-links\">\n  <a href=\"https://github.com/angular/angular/edit/master/packages/core/src/render3/util/discovery_utils.ts?message=docs(core)%3A%20describe%20your%20change...#L62-L80\" 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/core/src/render3/util/discovery_utils.ts#L62-L80\" 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=\"nggetcontext\">ng.getContext<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/core/global/ngGetContext#nggetcontext\"><i class=\"material-icons\">link</i></a></h1>\n    <label class=\"api-type-label global\">global</label>\n    <label class=\"api-type-label function\">function</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>If inside an embedded view (e.g. <code>*<a href=\"api/common/NgIf\" class=\"code-anchor\">ngIf</a></code> or <code>*<a href=\"api/common/NgForOf\" class=\"code-anchor\">ngFor</a></code>), retrieves the context of the embedded\nview that the element is part of. Otherwise retrieves the instance of the component whose view\nowns the element (in this case, the result is the same as calling <code><a href=\"api/core/global/ngGetOwningComponent\" class=\"code-anchor\">getOwningComponent</a></code>).</p>\n\n    \n  </section>\n  \n  \n  \n\n  <div class=\"overload-info\">\n  \n\n  <code-example language=\"ts\" hidecopy=\"true\" class=\"no-box api-heading\"> <span class=\"member-name\">ng.getContext</span>&#x3C;T>(element: Element): T | null</code-example>\n\n  \n\n  <h6 class=\"no-anchor\" id=\"parameters\">Parameters</h6>\n  <table class=\"is-full-width list-table parameters-table function-overload-parameters\">\n  <tbody>\n  \n    <tr class=\"function-overload-parameter\">\n      <td class=\"param-name\">\n        <a id=\"\"></a>\n        <code>element</code>\n      </td>\n      <td class=\"param-type\"><code>Element</code></td>\n      <td class=\"param-description\">\n      <p>Element for which to get the surrounding component instance.</p>\n\n      </td>\n    </tr>\n  </tbody>\n</table>\n\n  \n  <h6 class=\"no-anchor\" id=\"returns\">Returns</h6>\n     <p><code>T | null</code>: Instance of the component that is around the element or null if the element isn't\n   inside any component.</p>\n   \n  \n\n\n  \n\n  \n</div>\n\n\n  \n\n  \n\n\n\n  \n\n\n  </div>\n</article>\n\n<!-- links to this doc:\n - api/core/global\n - api/router/ChildrenOutletContexts\n-->\n<!-- links from this doc:\n - /api\n - api/common/NgForOf\n - api/common/NgIf\n - api/core\n - api/core/global\n - api/core/global/ngGetContext#nggetcontext\n - api/core/global/ngGetOwningComponent\n - https://github.com/angular/angular/edit/master/packages/core/src/render3/util/discovery_utils.ts?message=docs(core)%3A%20describe%20your%20change...#L62-L80\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/core/src/render3/util/discovery_utils.ts#L62-L80\n-->"
}