Introducing the new Ivy runtime API
If you have worked with Angular versions before Angular Ivy, you might be familiar with the NgProbe
API, which was available in the global scope at runtime as the ng.probe
function. Angular Ivy replaces this API with a set of new runtime debugging functions, which are only available in Angular development mode.
The new API contains the following functions:
ng.applyChanges(component: {}): void;
Mark the specified component for dirty checking if it is using the
OnPush
change detection strategy. Afterward, trigger a change detection cycle.ng.getComponent<T>(element: Element): T | null;
Resolve the Angular component that is attached to the specified DOM element.
ng.getContext<T>(element: Element): T | null;
When passed a DOM element generated by a structural directive such as
NgIf
orNgFor
, resolve the view context of the embedded view. In other cases, resolve the parent component.ng.getDirectiveMetadata(directiveOrComponentInstance...