{"id":6497,"date":"2022-09-04T19:47:23","date_gmt":"2022-09-04T17:47:23","guid":{"rendered":"https:\/\/www.angulararchitects.io\/?p=6497"},"modified":"2023-09-04T12:52:58","modified_gmt":"2023-09-04T10:52:58","slug":"angular-elements-web-components-with-standalone-components","status":"publish","type":"post","link":"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/","title":{"rendered":"Angular Elements: Web Components with Standalone Components"},"content":{"rendered":"<div class=\"wp-post-series-box series-angulars-future-without-ngmodules wp-post-series-box--expandable\">\n\t\t\t<input id=\"collapsible-series-angulars-future-without-ngmodules69f9da568d2fd\" class=\"wp-post-series-box__toggle_checkbox\" type=\"checkbox\">\n\t\n\t<label\n\t\tclass=\"wp-post-series-box__label\"\n\t\t\t\t\tfor=\"collapsible-series-angulars-future-without-ngmodules69f9da568d2fd\"\n\t\t\ttabindex=\"0\"\n\t\t\t\t>\n\t\t<p class=\"wp-post-series-box__name wp-post-series-name\">\n\t\t\tThis is post 5 of 8 in the series <em>&ldquo;Angular&#039;s Future with Standalone Components&rdquo;<\/em>\t\t<\/p>\n\t\t\t<\/label>\n\n\t\t\t<div class=\"wp-post-series-box__posts\">\n\t\t\t<ol>\n\t\t\t\t\t\t\t\t\t<li><a href=\"https:\/\/www.angulararchitects.io\/en\/blog\/angulars-future-without-ngmodules-lightweight-solutions-on-top-of-standalone-components\/\">Angular&#8217;s Future Without NgModules &#8211; Part 1: Lightweight Solutions Using Standalone Components<\/a><\/li>\n\t\t\t\t\t\t\t\t\t<li><a href=\"https:\/\/www.angulararchitects.io\/en\/blog\/angulars-future-without-ngmodules-part-2-what-does-that-mean-for-our-architecture\/\">Angular&#8217;s Future Without NgModules &#8211; Part 2: What Does That Mean for Our Architecture?<\/a><\/li>\n\t\t\t\t\t\t\t\t\t<li><a href=\"https:\/\/www.angulararchitects.io\/en\/blog\/4-ways-to-prepare-for-angulars-upcoming-standalone-components\/\">4 Ways to Prepare for Angular&#8217;s Upcoming Standalone Components<\/a><\/li>\n\t\t\t\t\t\t\t\t\t<li><a href=\"https:\/\/www.angulararchitects.io\/en\/blog\/routing-and-lazy-loading-with-standalone-components\/\">Routing and Lazy Loading with Angular&#8217;s Standalone Components<\/a><\/li>\n\t\t\t\t\t\t\t\t\t<li><span class=\"wp-post-series-box__current\">Angular Elements: Web Components with Standalone Components<\/span><\/li>\n\t\t\t\t\t\t\t\t\t<li><a href=\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/\">The Refurbished HttpClient in Angular 15 &#8211; Standalone APIs and Functional Interceptors<\/a><\/li>\n\t\t\t\t\t\t\t\t\t<li><a href=\"https:\/\/www.angulararchitects.io\/en\/blog\/testing-angular-standalone-components\/\">Testing Angular Standalone Components<\/a><\/li>\n\t\t\t\t\t\t\t\t\t<li><a href=\"https:\/\/www.angulararchitects.io\/en\/blog\/tutorial-automatically-migrating-to-standalone-components-in-3-steps\/\">Automatic Migration to Standalone Components in 3 Steps<\/a><\/li>\n\t\t\t\t\t\t\t<\/ol>\n\t\t<\/div>\n\t<\/div>\n<p>Since Angular 14.2, it\\'s possible to use Standalone Components as Angular Elements. In this article, I\\'m going to show you, how this new feature works.<\/p>\n<p>\ud83d\udcc2 <a href=\"https:\/\/github.com\/manfredsteyer\/standalone-components-elements\">Source Code<\/a><\/p>\n<h2>Providing a Standalone Component<\/h2>\n<p>The Standalone Component I\\'m going to use here is a simple Toggle Button called <code>ToggleComponent<\/code>:<\/p>\n<pre><code class=\"language-typescript\">import { Component, EventEmitter, Input, Output, ViewEncapsulation } from &#039;@angular\/core&#039;;\nimport { CommonModule } from &#039;@angular\/common&#039;;\n\n@Component({\n  selector: &#039;app-toggle&#039;,\n  standalone: true,\n  imports: [],\n  template: `\n    &lt;div class=&quot;toggle&quot; [class.active]=&quot;active&quot; (click)=&quot;toggle()&quot;&gt;\n      &lt;slot&gt;Toggle!&lt;\/slot&gt;\n    &lt;\/div&gt;\n  `,\n  styles: [`\n    .toggle {\n      padding:10px;\n      border: solid black 1px;\n      cursor: pointer;\n      display: inline\n    }\n\n    .active {\n      background-color: lightsteelblue;\n    }\n  `],\n  encapsulation: ViewEncapsulation.ShadowDom\n})\nexport class ToggleComponent {\n\n  @Input() active = false;\n  @Output() change = new EventEmitter&lt;boolean&gt;();\n\n  toggle(): void {\n    this.active = !this.active;\n    this.change.emit(this.active);\n  }\n\n}<\/code><\/pre>\n<p>By setting encapsulation to <code>ViewEncapsulation.ShadowDom<\/code>, I\\'m making the browser to use &quot;real&quot; Shadow DOM instead of Angular\\'s emulated counterpart. However, this also means that we have to use the Browser\\'s <code>slot<\/code> API for content projection instead of Angular\\'s <code>ng-content<\/code>.<\/p>\n<h2>Installing Angular Elements<\/h2>\n<p>While Angular Elements is directly provided by the Angular team, the CLI doesn\\'t install it. Hence, we need to do this by hand:<\/p>\n<pre><code class=\"language-bash\">npm i @angular\/elements<\/code><\/pre>\n<p>In former days, <code>@angular\/elements<\/code> also supported <code>ng add<\/code>. This support came with a schematic for adding a needed polyfill. However, meanwhile, all browsers supported by Angular can deal with Web Components natively. Hence, there is no need for such a polyfill anymore and so the support for <code>ng add<\/code> was already removed some versions ago.<\/p>\n<h2>Bootstrapping with Angular Elements<\/h2>\n<p>Now, let\\'s bootstrap our application and expose the <code>ToggleComponent<\/code> as a Web Component (Custom Element) with Angular Elements. For this, we can use the function <code>createApplication<\/code> added with Angular 14.2:<\/p>\n<pre><code class=\"language-typescript\">\/\/ main.ts\n\nimport { createCustomElement } from &#039;@angular\/elements&#039;;\nimport { createApplication } from &#039;@angular\/platform-browser&#039;;\nimport { ToggleComponent } from &#039;.\/app\/toggle\/toggle.component&#039;;\n\n(async () =&gt; {\n\n  const app = await createApplication({\n    providers: [\n      \/* your global providers here *\/\n    ],\n  });\n\n  const toogleElement = createCustomElement(ToggleComponent, {\n    injector: app.injector,\n  });\n\n  customElements.define(&#039;my-toggle&#039;, toogleElement);\n\n})();<\/code><\/pre>\n<p>We could pass an array with providers to <code>createApplication<\/code>. This allows to provide services like the <code>HttpClient<\/code> via the application\\'s root scope. In general, this option is needed when we want to configure these providers, e. g. with a <code>forRoot<\/code> method or a <code>provideXYZ<\/code> function. In all other cases, it\\'s preferable to just go with tree-shakable providers (<code>providedIn: &#039;root&#039;<\/code>).<\/p>\n<p>The result of <code>createApplication<\/code> is a new <code>ApplicationRef<\/code>. We can pass it\\'s Injector alongside the <code>ToggleComponent<\/code> to <code>createCustomElement<\/code>. The result is a custom element that can be registered with the browser using <code>customElements.define<\/code>.<\/p>\n<p>Please note that the current API does not allow for setting an own zone instance like the <code>noop<\/code> zone. Instead, the Angular team wants to concentrate on new features for zone-less change detection in the future.<\/p>\n<h2>Side Note: Bootstrapping Multiple Components<\/h2>\n<p>The API shown also allows to create several custom elements:<\/p>\n<pre><code class=\"language-typescript\">const element1 = createCustomElement(ThisComponent, {\n    injector: app.injector,\n});\n\nconst element2 = createCustomElement(ThatComponent, {\n    injector: app.injector,\n});<\/code><\/pre>\n<p>Besides working with custom elements, the <code>ApplicationRef<\/code> at hand also allows for bootstrapping several components as Angular applications:<\/p>\n<pre><code class=\"language-typescript\">app.injector.get(NgZone).run(() =&gt; {\n    app.bootstrap(ToggleComponent, &#039;my-a&#039;);\n    app.bootstrap(ToggleComponent, &#039;my-b&#039;);\n});<\/code><\/pre>\n<p>When bootstrapping a component this way, one can overwrite the selector to use. Please note, that one has to call <code>bootstrap<\/code> within a zone in order to get change detection.<\/p>\n<p>Bootstrapping several components was originally done by placing several components in your <code>AppModule<\/code>\\'s <code>bootstrap<\/code> array. The <code>bootstrapApplication<\/code> function used for bootstrapping Standalone Components does, however, not allow for this as the goal was to provide a simple API for the most common use case.<\/p>\n<h2>Calling an Angular Element<\/h2>\n<p>To call our Angular Element, we just need to place a respective tag in our <code>index.html<\/code>:<\/p>\n<pre><code class=\"language-html\">&lt;h1&gt;Standalone Angular Element Demo&lt;\/h1&gt;\n&lt;my-toggle id=&quot;myToggle&quot;&gt;Click me!&lt;\/my-toggle&gt;<\/code><\/pre>\n<p>As a custom element is threaded by the browser as a normal DOM node, we can use traditional DOM calls to set up events and to assign values to properties:<\/p>\n<pre><code class=\"language-html\">&lt;script&gt;\n  const myToggle = document.getElementById(&#039;myToggle&#039;);\n\n  myToggle.addEventListener(&#039;change&#039;, (event) =&gt; {\n    console.log(&#039;active&#039;, event.detail);\n  });\n\n  setTimeout(() =&gt; {\n    myToggle.active = true; \n  }, 3000);\n&lt;\/script&gt;<\/code><\/pre>\n<h2>Calling a Web Component in an Angular Component<\/h2>\n<p>If we call a web component within an Angular component, we can directly data bind to it using brackets for properties and parenthesis for events. This works regardless whether the web component was created with Angular or not.<\/p>\n<p>To demonstrate this, let\\'s assume we have the following AppComponent:<\/p>\n<pre><code class=\"language-typescript\">import { Component, CUSTOM_ELEMENTS_SCHEMA } from &#039;@angular\/core&#039;;\n\n@Component({\n  selector: &#039;app-root&#039;,\n  standalone: true,\n  schemas: [CUSTOM_ELEMENTS_SCHEMA],\n  template: `\n    &lt;h2&gt;Root Component&lt;\/h2&gt;\n    &lt;my-toggle \n        [active]=&quot;active&quot; \n        (change)=&quot;change($event)&quot;&gt;\n        Hello!\n    &lt;\/my-toggle&gt;\n  `,\n})\nexport class AppComponent {\n    active = false;\n    change(event: Event) {\n        const customEvent = event as CustomEvent&lt;boolean&gt;;\n        console.log(&#039;active&#039;, customEvent.detail);\n    }\n}<\/code><\/pre>\n<p>This Standalone Component calls our <code>my-toggle<\/code> web component. While the Angular compiler is aware of all possible Angular components, it doesn\\'t know about web components. Hence, it would throw an error when seeing the <code>my-toggle<\/code> tag. To avoid this, we need to register the <code>CUSTOM_ELEMENTS_SCHEMA<\/code> schema.<\/p>\n<p>Before, we did this with all the NgModules we wanted to use together with Web Components. Now, we can directly register this schema with Standalone Components. Technically, this just disables the compiler checks regarding possible tag names. This is binary - the checks are either on or off -- and there is no way to directly tell the compiler about the available web components.<\/p>\n<p>To make this component appear on our page, we need to bootstrap it:<\/p>\n<pre><code class=\"language-typescript\">\/\/ main.ts\n\n[...]\n\/\/ Register web components ...\n[...]\n\napp.injector.get(NgZone).run(() =&gt; {\n  app.bootstrap(AppComponent);\n});<\/code><\/pre>\n<p>Also, we need to add an element for AppComponent to the index.html:<\/p>\n<pre><code class=\"language-html\">&lt;app-root&gt;&lt;\/app-root&gt;<\/code><\/pre>\n<h2>Bonus: Compiling Self-contained Bundle<\/h2>\n<p>Now, let\\'s assume, we only provide a custom element and don\\'t bootstrap our <code>AppComponent<\/code>. In order to use this custom element in other applications, we need to compile it into a self contained bundle. While the default webpack-based builder emits several bundles, e. g. a main bundle and a runtime bundle, the new -- still experimental -- esbuild-based one just gives us one bundle for our source code and another one for the polyfills.<\/p>\n<p>To activate it, adjust your project settings in your <code>angular.json<\/code> as follows:<\/p>\n<pre><code class=\"language-json\">&quot;build&quot;: {\n    &quot;builder&quot;: &quot;@angular-devkit\/build-angular:browser-esbuild&quot;,\n    [...]\n}<\/code><\/pre>\n<p>Normally, you just have to add <code>-esbuild<\/code> at the end of the default builder.<\/p>\n<p>The resulting bundles look like this:<\/p>\n<pre><code class=\"language-bash\">favicon.ico (948 bytes)\nindex.html (703 bytes)\nmain.43BPAPVS.js (100\u00a0177 bytes)\npolyfills.M7XCYQVG.js (33\u00a0916 bytes)\nstyles.VFXLKGBH.css (0 bytes)<\/code><\/pre>\n<p>If you use your web component in an other web site, e. g. a CMS-driven one, just reference the main bundle there and add a respective tag. Also, reference the polyfills. However, when using several such bundles, you have to make sure, you only load the polyfills once.<\/p>\n<p>The last listing also shows a tradeoff of Angular Elements: Parts of Angular end up in the bundle. Hence, we have an overhead of some KB per bundle.<\/p>\n<h2>What\\'s next? More on Architecture!<\/h2>\n<p>Standalone Components are quite interesting for our architectures. However, there are also other topics we need to considern:<\/p>\n<ul>\n<li>According to which criteria can we subdivide a huge application into sub-domains?<\/li>\n<li>How can we make sure, the solution is maintainable for years or even decades?<\/li>\n<li>Which options from Micro Frontends are provided by Module Federation?<\/li>\n<\/ul>\n<p>Our free eBook (about 120 pages) covers all these questions and more:<\/p>\n<p><a href=\"https:\/\/www.angulararchitects.io\/book\"><img decoding=\"async\" src=\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/12\/cover-5th-small.png\" alt=\"free\" \/><\/a><\/p>\n<p>Feel free to <a href=\"https:\/\/www.angulararchitects.io\/en\/book\">download it here<\/a> now!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since Angular 14.2, it&#8217;s possible to use Standalone Components as Angular Elements.<\/p>\n","protected":false},"author":9,"featured_media":6498,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":"[]","_tribe_ticket_has_attendee_info_fields":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-6497","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","post_series-angulars-future-without-ngmodules"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Angular Elements: Web Components with Standalone Components - ANGULARarchitects<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Angular Elements: Web Components with Standalone Components - ANGULARarchitects\" \/>\n<meta property=\"og:description\" content=\"Since Angular 14.2, it&#039;s possible to use Standalone Components as Angular Elements.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/\" \/>\n<meta property=\"og:site_name\" content=\"ANGULARarchitects\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-04T17:47:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-04T10:52:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/09\/standalone-elements.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Manfred Steyer, GDE\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/09\/standalone-elements.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@daniel\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Manfred Steyer, GDE\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/\"},\"author\":{\"name\":\"Manfred Steyer, GDE\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/15628efa7af4475ffaaeeb26c5112951\"},\"headline\":\"Angular Elements: Web Components with Standalone Components\",\"datePublished\":\"2022-09-04T17:47:23+00:00\",\"dateModified\":\"2023-09-04T10:52:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/\"},\"wordCount\":930,\"publisher\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/09\/shutterstock-1991849012.jpg\",\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/\",\"url\":\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/\",\"name\":\"Angular Elements: Web Components with Standalone Components - ANGULARarchitects\",\"isPartOf\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/09\/shutterstock-1991849012.jpg\",\"datePublished\":\"2022-09-04T17:47:23+00:00\",\"dateModified\":\"2023-09-04T10:52:58+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/#primaryimage\",\"url\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/09\/shutterstock-1991849012.jpg\",\"contentUrl\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/09\/shutterstock-1991849012.jpg\",\"width\":500,\"height\":331},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.angulararchitects.io\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Angular Elements: Web Components with Standalone Components\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#website\",\"url\":\"https:\/\/www.angulararchitects.io\/en\/\",\"name\":\"ANGULARarchitects\",\"description\":\"AngularArchitects.io\",\"publisher\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.angulararchitects.io\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#organization\",\"name\":\"ANGULARarchitects\",\"alternateName\":\"SOFTWAREarchitects\",\"url\":\"https:\/\/www.angulararchitects.io\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2023\/07\/AA-Logo-RGB-horizontal-inside-knowledge-black.svg\",\"contentUrl\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2023\/07\/AA-Logo-RGB-horizontal-inside-knowledge-black.svg\",\"width\":644,\"height\":216,\"caption\":\"ANGULARarchitects\"},\"image\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/github.com\/angular-architects\",\"https:\/\/www.linkedin.com\/company\/angular-architects\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/15628efa7af4475ffaaeeb26c5112951\",\"name\":\"Manfred Steyer, GDE\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a0b59539674d8b71ea1c1f4764b11244b5f499203f1d11b40f37d8f3f90be033?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a0b59539674d8b71ea1c1f4764b11244b5f499203f1d11b40f37d8f3f90be033?s=96&d=mm&r=g\",\"caption\":\"Manfred Steyer, GDE\"},\"sameAs\":[\"https:\/\/x.com\/daniel\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Angular Elements: Web Components with Standalone Components - ANGULARarchitects","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/","og_locale":"en_US","og_type":"article","og_title":"Angular Elements: Web Components with Standalone Components - ANGULARarchitects","og_description":"Since Angular 14.2, it's possible to use Standalone Components as Angular Elements.","og_url":"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/","og_site_name":"ANGULARarchitects","article_published_time":"2022-09-04T17:47:23+00:00","article_modified_time":"2023-09-04T10:52:58+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/09\/standalone-elements.jpg","type":"image\/jpeg"}],"author":"Manfred Steyer, GDE","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/09\/standalone-elements.jpg","twitter_creator":"@daniel","twitter_misc":{"Written by":"Manfred Steyer, GDE","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/#article","isPartOf":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/"},"author":{"name":"Manfred Steyer, GDE","@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/15628efa7af4475ffaaeeb26c5112951"},"headline":"Angular Elements: Web Components with Standalone Components","datePublished":"2022-09-04T17:47:23+00:00","dateModified":"2023-09-04T10:52:58+00:00","mainEntityOfPage":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/"},"wordCount":930,"publisher":{"@id":"https:\/\/www.angulararchitects.io\/en\/#organization"},"image":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/#primaryimage"},"thumbnailUrl":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/09\/shutterstock-1991849012.jpg","inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/","url":"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/","name":"Angular Elements: Web Components with Standalone Components - ANGULARarchitects","isPartOf":{"@id":"https:\/\/www.angulararchitects.io\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/#primaryimage"},"image":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/#primaryimage"},"thumbnailUrl":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/09\/shutterstock-1991849012.jpg","datePublished":"2022-09-04T17:47:23+00:00","dateModified":"2023-09-04T10:52:58+00:00","breadcrumb":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/#primaryimage","url":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/09\/shutterstock-1991849012.jpg","contentUrl":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/09\/shutterstock-1991849012.jpg","width":500,"height":331},{"@type":"BreadcrumbList","@id":"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.angulararchitects.io\/en\/"},{"@type":"ListItem","position":2,"name":"Angular Elements: Web Components with Standalone Components"}]},{"@type":"WebSite","@id":"https:\/\/www.angulararchitects.io\/en\/#website","url":"https:\/\/www.angulararchitects.io\/en\/","name":"ANGULARarchitects","description":"AngularArchitects.io","publisher":{"@id":"https:\/\/www.angulararchitects.io\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.angulararchitects.io\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.angulararchitects.io\/en\/#organization","name":"ANGULARarchitects","alternateName":"SOFTWAREarchitects","url":"https:\/\/www.angulararchitects.io\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2023\/07\/AA-Logo-RGB-horizontal-inside-knowledge-black.svg","contentUrl":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2023\/07\/AA-Logo-RGB-horizontal-inside-knowledge-black.svg","width":644,"height":216,"caption":"ANGULARarchitects"},"image":{"@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/github.com\/angular-architects","https:\/\/www.linkedin.com\/company\/angular-architects\/"]},{"@type":"Person","@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/15628efa7af4475ffaaeeb26c5112951","name":"Manfred Steyer, GDE","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a0b59539674d8b71ea1c1f4764b11244b5f499203f1d11b40f37d8f3f90be033?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a0b59539674d8b71ea1c1f4764b11244b5f499203f1d11b40f37d8f3f90be033?s=96&d=mm&r=g","caption":"Manfred Steyer, GDE"},"sameAs":["https:\/\/x.com\/daniel"]}]}},"_links":{"self":[{"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/posts\/6497","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/comments?post=6497"}],"version-history":[{"count":1,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/posts\/6497\/revisions"}],"predecessor-version":[{"id":22320,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/posts\/6497\/revisions\/22320"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/media\/6498"}],"wp:attachment":[{"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/media?parent=6497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/categories?post=6497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/tags?post=6497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}