Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

NgElement

Implements the functionality needed for a custom element.

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

Properties

Property Description
protected abstract ngElementStrategy: NgElementStrategy

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

protected ngElementEventsSubscription: Subscription | null

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

Methods

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

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

The name of the attribute that has changed.

oldValue string

The previous value of the attribute.

newValue string

The new value of the attribute.

namespace string

The namespace in which the attribute is defined.

Optional. Default is undefined.

Returns

void: Nothing.

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

      
      abstract connectedCallback(): void
    
Parameters

There are no parameters.

Returns

void: Nothing.

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

      
      abstract disconnectedCallback(): void
    
Parameters

There are no parameters.

Returns

void: Nothing.