DebugElement
constructor
DebugElementElementDebugElementnativeElement
anyThe underlying DOM element at the root of the component.
name
stringThe element tag name, if it is an element.
properties
{ [key: string]: any; }Gets a map of property names to property values for an element.
This map includes:
- Regular property bindings (e.g.
[id]="id") - Host property bindings (e.g.
host: { '[id]': "id" }) - Interpolated property bindings (e.g. `id="{{ value }}")
It does not include:
- input property bindings (e.g.
[myCustomInput]="value") - attribute bindings (e.g.
[attr.role]="menu")
attributes
{ [key: string]: string | null; }A map of attribute names to attribute values for an element.
styles
{ [key: string]: string | null; }The inline styles of the DOM element.
classes
{ [key: string]: boolean; }A map containing the class names on the element as keys.
This map is derived from the className property of the DOM element.
Note: The values of this object will always be true. The class key will not appear in the KV
object if it does not exist on the element.
children
DebugElement[]The immediate DebugElement children. Walk the tree by descending through children.
query
DebugElementDebugElementqueryAll
DebugElement[]DebugElement[]triggerEventHandler
voidTriggers the event by its name if there is a corresponding listener in the element's
listeners collection.
If the event lacks a listener or there's some other problem, consider
calling nativeElement.dispatchEvent(eventObject).
stringThe name of the event to trigger
anyThe event object expected by the handler
voidnativeNode
anyThe underlying DOM node.
parent
DebugElement | nullThe DebugElement parent. Will be null if this is the root element.
injector
InjectorThe host dependency injector. For example, the root element's component instance injector.
componentInstance
anyThe element's own component instance, if it has one.
context
anyAn object that provides parent context for this element. Often an ancestor component instance that governs this element.
When an element is repeated within *ngFor, the context is an NgForOf whose $implicit
property is the value of the row instance value. For example, the hero in *ngFor="let hero of heroes".
listeners
DebugEventListener[]The callbacks attached to the component's @Output properties and/or the element's event properties.
references
{ [key: string]: any; }Dictionary of objects associated with template local variables (e.g. #foo), keyed by the local variable name.
providerTokens
any[]This component's injector lookup tokens. Includes the component itself plus the tokens that the component lists in its providers metadata.