填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

@angular/core/global

Exposes a set of functions in the global namespace which are useful for debugging the current state of your application. These functions are exposed via the global ng "namespace" variable automatically when you import from @angular/core and run your application in development mode. These functions are not exposed when the application runs in a production mode.

入口点的导出

Entry point exports

函数

Functions

ng.applyChanges

把一个组件标记为需要检查(OnPush 组件中),并且在本组件所属的应用中同步执行执行变更检测。

Marks a component for check (in case of OnPush components) and synchronously performs change detection on the application this component belongs to.

ng.getComponent

检索与给定 DOM 元素关联的组件实例。

Retrieves the component instance associated with a given DOM element.

ng.getContext

如果在嵌入式视图中(例如 *ngIf*ngFor),则检索元素所属的嵌入式视图的上下文。否则,检索其视图中拥有该元素的组件的实例(在这种情况下,其结果与调用 getOwningComponent 相同)。

If inside an embedded view (e.g. *ngIf or *ngFor), retrieves the context of the embedded view that the element is part of. Otherwise retrieves the instance of the component whose view owns the element (in this case, the result is the same as calling getOwningComponent).

ng.getDirectiveMetadata

Returns the debug (partial) metadata for a particular directive or component instance. The function accepts an instance of a directive or component and returns the corresponding metadata.

ng.getDirectives

检索与给定 DOM 元素关联的指令实例。不包括组件实例。

Retrieves directive instances associated with a given DOM node. Does not include component instances.

ng.getHostElement

检索组件或指令实例的宿主元素。 宿主元素是与指令的选择器匹配的 DOM 元素。

Retrieves the host element of a component or directive instance. The host element is the DOM element that matched the selector of the directive.

ng.getInjector

检索与元素、组件或指令实例关联的 Injector

Retrieves an Injector associated with an element, component or directive instance.

ng.getListeners

检索与 DOM 元素关联的事件监听器的列表。该列表包含宿主监听器,但不包含在 Angular 上下文之外定义的事件监听器(例如,通过 addEventListener )。

Retrieves a list of event listeners associated with a DOM element. The list does include host listeners, but it does not include event listeners defined outside of the Angular context (e.g. through addEventListener).

ng.getOwningComponent

检索其视图中包含此 DOM 元素的组件实例。

Retrieves the component instance whose view contains the DOM element.

ng.getRootComponents

检索与 DOM 元素,指令或组件实例关联的所有根组件。根组件是由 Angular 引导启动的组件。

Retrieves all root components associated with a DOM element, directive or component instance. Root components are those which have been bootstrapped by Angular.

结构

Structures

ComponentDebugMetadata

Partial metadata for a given component instance. This information might be useful for debugging purposes or tooling. Currently the following fields are available:

  • inputs
  • outputs
  • encapsulation
  • changeDetection
DirectiveDebugMetadata

Partial metadata for a given directive instance. This information might be useful for debugging purposes or tooling. Currently only inputs and outputs metadata is available.

Listener

getListeners 返回的事件监听器配置。

Event listener configuration returned from getListeners.