{ "id": "api/elements/NgElement", "title": "NgElement", "contents": "\n\n
\n
\n
\n \n API > @angular/elements\n
\n \n
\n \n
\n

NgElementlink

\n \n \n \n \n \n
\n \n \n\n
\n \n
\n

Implements the functionality needed for a custom element.

\n\n \n
\n \n \n \n
\n\nabstract class NgElement extends HTMLElement {\n protected abstract ngElementStrategy: NgElementStrategy\n protected ngElementEventsSubscription: Subscription | null\n abstract attributeChangedCallback(attrName: string, oldValue: string, newValue: string, namespace?: string): void\n abstract connectedCallback(): void\n abstract disconnectedCallback(): void\n}\n\n\n \n \n\n
\n\n\n \n\n \n \n \n\n\n\n\n\n\n\n\n
\n

Propertieslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
PropertyDescription
\n \n protected abstract ngElementStrategy: NgElementStrategy\n \n \n

The strategy that controls how a component is transformed in a custom element.

\n\n \n
\n \n protected ngElementEventsSubscription: Subscription | null\n \n \n

A subscription to change, connect, and disconnect events in the custom element.

\n\n \n
\n
\n\n\n\n
\n

Methodslink

\n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n attributeChangedCallback()\n \n link

\n \n
\n
\n

Prototype for a handler that responds to a change in an observed attribute.

\n\n
\n
\n \n\n abstract attributeChangedCallback(attrName: string, oldValue: string, newValue: string, namespace?: string): void\n\n \n\n
Parameters
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n attrName\n string\n

The name of the attribute that has changed.

\n\n
\n \n oldValue\n string\n

The previous value of the attribute.

\n\n
\n \n newValue\n string\n

The new value of the attribute.

\n\n
\n \n namespace\n string\n

The namespace in which the attribute is defined.

\n

Optional. Default is undefined.

\n\n
\n\n \n
Returns
\n

void: Nothing.

\n\n \n\n\n \n\n \n
\n
\n\n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n connectedCallback()\n \n link

\n \n
\n
\n

Prototype for a handler that responds to the insertion of the custom element in the DOM.

\n\n
\n
\n \n\n abstract connectedCallback(): void\n\n \n\n
Parameters
\n

There are no parameters.

\n\n \n
Returns
\n

void: Nothing.

\n\n \n\n\n \n\n \n
\n
\n\n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n disconnectedCallback()\n \n link

\n \n
\n
\n

Prototype for a handler that responds to the deletion of the custom element from the DOM.

\n\n
\n
\n \n\n abstract disconnectedCallback(): void\n\n \n\n
Parameters
\n

There are no parameters.

\n\n \n
Returns
\n

void: Nothing.

\n\n \n\n\n \n\n \n
\n
\n\n \n
\n\n\n\n \n\n\n
\n
\n\n\n" }