PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteUse Angular Elements when you want an Angular component to behave like a browser custom element that can be inserted into ordinary HTML or another framework. Install @angular/elements, create a constructor with createCustomElement(), and register it with customElements.define(). Component inputs become attributes or properties, while outputs become DOM Custom Events.
How Angular Elements work
Angular Elements packages Angular components as custom elements—also called Web Components—using the browser’s custom-element mechanism. The browser’s CustomElementRegistry associates a tag name with its constructor; Angular’s @angular/elements package bridges the component interface and Angular change detection to that DOM API. Angular documents createCustomElement() as stable. It returns an NgElementConstructor based on the component and configuration, whose injector is the default injector for instances. See the Angular Elements guide and the createCustomElement API reference.
Register a component as a custom element
-
Install
@angular/elementswith the package manager your Angular project uses. -
Import
createCustomElementfrom@angular/elements, then create a constructor from your component and an injector configuration.What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Register the constructor with the browser, for example:
customElements.define('app-greeting-element', GreetingComponentElement). -
Use the registered tag in the DOM and communicate with it using attributes or properties for inputs and DOM events for outputs.
Choose a tag name that is different from the Angular component’s selector. Angular warns that reusing the selector can cause Angular to create both a regular component instance and a custom-element instance on the same DOM element.
Pass inputs and listen for outputs
Inputs: attributes and properties
Angular exposes component inputs as properties on the custom element and maps them to HTML attributes. Since HTML attribute names do not preserve case distinctions, Angular converts input names to dash-separated lowercase. For example, an input alias named myInputProp is exposed as the attribute my-input-prop. Use the public input name or alias as the element’s data contract.
Recommended Free Tools
Outputs: Custom Events
Each component output is emitted as an HTML Custom Event. The event name is the output name or its alias, and the value emitted by the component is available as event.detail. That lets a non-Angular host listen with ordinary DOM event handling:
element.addEventListener('valueChanged', event => {
console.log(event.detail);
});
Replace valueChanged with the output’s public name or alias. The event detail contains the value emitted by that output.
Use a custom element in an Angular template
Angular’s template checker reports unknown elements by default. For a custom element in an Angular template, add CUSTOM_ELEMENTS_SCHEMA to the relevant schema metadata. A standalone component can declare it in its schemas property; NgModule-based applications can declare it in the module metadata. The schema permits non-Angular dash-case elements and dash-case properties. See the component configuration guide and CUSTOM_ELEMENTS_SCHEMA API reference.
NO_ERRORS_SCHEMA is broader: it permits any element and any property. It is not interchangeable with the specific custom-element allowance; see the NO_ERRORS_SCHEMA API reference.
Type custom elements in TypeScript
Generic DOM APIs do not infer the component-specific properties of an arbitrary custom tag. Angular documents two ways to supply that type information:
Rank #4
-
Cast a result to
NgElement & WithProperties<{...}>, describing the custom element’s input properties. -
Augment
HTMLElementTagNameMapfor the registered tag so DOM methods can infer its element type.
These options provide TypeScript with the element shape; registration with customElements.define() still establishes the tag at runtime.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Best Value
Angular Elements or dynamic component creation?
Choose based on the interface your host needs. Angular Elements is suited to a reusable DOM tag with attributes, properties, and events. Programmatic createComponent() is suited to Angular-managed dynamic construction when a registered, reusable custom tag is not the goal.
| Consideration | Angular Elements | Dynamic createComponent() |
|---|---|---|
| Integration surface | A browser custom-element tag, DOM properties, and Custom Events. | An Angular component reference and application-managed view. |
| Lifecycle work | Angular Elements integrates the component with the custom element’s DOM connection lifecycle. | The application handles view attachment and cleanup. |
| Data flow | HTML attributes or element properties for inputs; DOM events for outputs. | Set component inputs and subscribe to outputs through Angular APIs. |
| Angular templates | Use an appropriate schema to allow the custom tag in template validation. | Construct the component within Angular rather than relying on a custom tag. |
With dynamic creation, the documented workflow includes providing an EnvironmentInjector, attaching the host view to ApplicationRef so it participates in change detection, setting inputs, subscribing to outputs, and detaching or cleaning up the view. Angular Elements automates that integration when the desired interface is a DOM element. See the createComponent API reference.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




