EmbeddedViewRef
Represents an Angular view in a view container.
An embedded view can be referenced from a component
other than the hosting component whose template defines it, or it can be defined
independently by a TemplateRef.
context
CThe context for this view, inherited from the anchor element.
rootNodes
any[]The root nodes for this embedded view.
destroy
voidDestroys this view and all of the data structures associated with it.
voiddestroyed
booleanReports whether this view has been destroyed.
onDestroy
voidA lifecycle hook that provides additional developer-defined cleanup functionality for views.
FunctionA handler function that cleans up developer-defined data
associated with a view. Called when the destroy() method is invoked.
voidmarkForCheck
voidWhen a view uses the ChangeDetectionStrategy#OnPush (checkOnce)
change detection strategy, explicitly marks the view as changed so that
it can be checked again.
Components are normally marked as dirty (in need of rerendering) when inputs have changed or events have fired in the view. Call this method to ensure that a component is checked even if these triggers have not occurred.
voiddetach
voidDetaches this view from the change-detection tree.
A detached view is not checked until it is reattached.
Use in combination with detectChanges() to implement local change detection checks.
Detached views are not checked during change detection runs until they are re-attached, even if they are marked as dirty.
voiddetectChanges
voidChecks this view and its children. Use in combination with ChangeDetectorRef#detach
to implement local change detection checks.
voidcheckNoChanges
voidChecks the change detector and its children, and throws if any changes are detected.
Use in development mode to verify that running change detection doesn't introduce other changes. Calling it in production mode is a noop.
voidreattach
voidRe-attaches the previously detached view to the change detection tree. Views are attached to the tree by default.
voidDescription
Represents an Angular view in a view container.
An embedded view can be referenced from a component
other than the hosting component whose template defines it, or it can be defined
independently by a TemplateRef.
Properties of elements in a view can change, but the structure (number and order) of elements in a view cannot. Change the structure of elements by inserting, moving, or removing nested views in a view container.
Usage Notes
The following template breaks down into two separate TemplateRef instances,
an outer one and an inner one.
Count: {{items.length}}<ul> <li *ngFor="let item of items">{{item}}</li></ul>
This is the outer TemplateRef:
Count: {{items.length}}<ul> <ng-template ngFor let-item [ngForOf]="items"></ng-template></ul>
This is the inner TemplateRef:
<li>{{item}}</li>
The outer and inner TemplateRef instances are assembled into views as follows: