NgElement

Implements the functionality needed for a custom element.

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

属性

属性说明
protected 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.

方法

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

abstract attributeChangedCallback(attrName: string, oldValue: string, newValue: string, namespace?: string): void
      
      abstract attributeChangedCallback(attrName: string, oldValue: string, newValue: string, namespace?: string): void
    
参数
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

可选. 默认值是 undefined.

The namespace in which the attribute is defined.

返回值

void: Nothing.

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

abstract connectedCallback(): void
      
      abstract connectedCallback(): void
    
参数

没有参数。

返回值

void: Nothing.

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

abstract disconnectedCallback(): void
      
      abstract disconnectedCallback(): void
    
参数

没有参数。

返回值

void: Nothing.