填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫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.