W3cubDocs

/Angular 11

createCustomElement

function

Creates a custom element class based on an Angular component.

See more...

createCustomElement<P>(component: Type<any>, config: NgElementConfig): NgElementConstructor<P>

Parameters
component Type

The component to transform.

config NgElementConfig

A configuration that provides initialization information to the created class.

Returns

NgElementConstructor<P>: The custom-element construction class, which can be registered with a browser's CustomElementRegistry.

See also

Description

Builds a class that encapsulates the functionality of the provided component and uses the configuration information to provide more context to the class. Takes the component factory's inputs and outputs to convert them to the proper custom element API and add hooks to input changes.

The configuration's injector is the initial injector set on the class, and used by default for each created instance.This behavior can be overridden with the static property to affect all newly created instances, or as a constructor argument for one-off creations.

© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v11.angular.io/api/elements/createCustomElement