EmbeddedViewRef class abstract
An embedded Angular view that can be created and destroyed dynamically.
An embedded view is instantiated from a TemplateRef, and can be inserted
into a ViewContainerRef.
This is the public interface which only generated embedded views implement. It adds additional functionality to ViewRef that is specific to embedded views, such as manipulating template local variables.
Example
Consider the following template:
<ul>
<li *ngFor="let item of items">{{item}}</li>
</ul>
Note the *-binding is just sugar for the following:
<ul>
<template ngFor let-item [ngForOf]="items">
<!-- TemplateRef -->
<li>{{item}}</li>
</template>
</ul>
In this example, item is a template input variable that is local to each
embedded view created from this template.
Given items = ['First', 'Second'], this example would render:
<ul>
<!-- EmbeddedViewRef -->
<li>First</li>
<!-- EmbeddedViewRef -->
<li>Second</li>
</ul>
Note how ngFor has used the TemplateRef to create an EmbeddedViewRef
for each item.
- Implemented types
Constructors
Properties
Methods
-
destroy(
) → void - Detaches this view and destroys all of its associated state.
-
hasLocal(
String name) → bool -
Checks whether this view has a local variable called
name. -
markForCheck(
) → void - Marks this view to be change detected in an "OnPush" context.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDestroy(
void callback()) → void -
Registers a
callbackto invoke when this view is destroyed.inherited -
setLocal(
String name, Object? value) → void -
Sets the
valueof local variable callednamein this view. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited