NgTemplateOutlet class

Inserts an embedded view, created from a TemplateRef.

Examples

@Component(
  selector: 'example',
  template: '''
    <template #text let-text>
      <span>{{text}}</span>
    </template>
    <template #icon let-iconUrl let-width="width" let-height="height">
      <img [src]="iconUrl" [width]="width" [height]="height">
    </template>

    <!-- An example of providing a single value -->
    <template
        [ngTemplateOutlet]="text"
        [ngTemplateOutletValue]="textContext">
    </template>

    <!-- An example of providing a map of key/value pairs -->
    <template
        [ngTemplateOutlet]="icon">
        [ngTemplateOutletContext]="iconContext">
    </template>
  ''',
  directives: const [NgTemplateOutlet],
)
class ExampleComponent {
  final textContext = 'Hello world!';

  final iconContext = {
    '\$implicit': 'icon.png',
    'width': '16',
    'height': '16',
  };
}
Implemented types
Annotations

Constructors

NgTemplateOutlet(ViewContainerRef _viewContainerRef)

Properties

hashCode int
The hash code for this object.
no setterinherited
ngTemplateOutlet TemplateRef?
The TemplateRef used to create the embedded view.
no getter
ngTemplateOutletContext Map<String, Object?>
An optional map of local variables to define in the embedded view.
no getter
ngTemplateOutletValue Object?
Provides a value to be assigned in scope to the provided template.
no getter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

ngDoCheck() → void
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited