{
  "id": "api/core/global/ngGetOwningComponent",
  "title": "ng.getOwningComponent",
  "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/ngGetOwningComponent\", \"name\": \"ng.getOwningComponent\" } }\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...#L81-L108\" 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#L81-L108\" 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=\"nggetowningcomponent\">ng.getOwningComponent<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/core/global/ngGetOwningComponent#nggetowningcomponent\"><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>Retrieves the component instance whose view contains the DOM element.</p>\n\n    <p><a href=\"api/core/global/ngGetOwningComponent#description\">See more...</a></p>\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.getOwningComponent</span>&#x3C;T>(elementOrDir: {} | 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>elementOrDir</code>\n      </td>\n      <td class=\"param-type\"><code>{} | Element</code></td>\n      <td class=\"param-description\">\n      <p>DOM element, component or directive instance\nfor which to retrieve the root components.</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>: Component instance whose view owns the DOM element or null if the element is not\n   part of a component view.</p>\n   \n  \n\n\n  \n\n  \n</div>\n\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/core/global/ngGetOwningComponent#description\"><i class=\"material-icons\">link</i></a></h2>\n  <p>For example, if <code>&#x3C;child-comp></code> is used in the template of <code>&#x3C;app-comp></code>\n(i.e. a <code><a href=\"api/core/ViewChild\" class=\"code-anchor\">ViewChild</a></code> of <code>&#x3C;app-comp></code>), calling <code><a href=\"api/core/global/ngGetOwningComponent\" class=\"code-anchor\">getOwningComponent</a></code> on <code>&#x3C;child-comp></code>\nwould return <code>&#x3C;app-comp></code>.</p>\n\n  \n</section>\n\n\n\n  \n\n\n  </div>\n</article>\n\n<!-- links to this doc:\n - api/core/global\n - api/core/global/ngGetContext\n-->\n<!-- links from this doc:\n - /api\n - api/core\n - api/core/ViewChild\n - api/core/global\n - api/core/global/ngGetOwningComponent#description\n - api/core/global/ngGetOwningComponent#nggetowningcomponent\n - https://github.com/angular/angular/edit/master/packages/core/src/render3/util/discovery_utils.ts?message=docs(core)%3A%20describe%20your%20change...#L81-L108\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/core/src/render3/util/discovery_utils.ts#L81-L108\n-->"
}