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="w" let-height="h">
      <img src="{{iconUrl}}" width="{{width}}" height="{{height}}">
    </template>

    <template
        [ngTemplateOutlet]="text"
        [ngTemplateOutletContext]="textContext">
    </template>
    <template
        [ngTemplateOutlet]="icon">
        [ngTemplateOutletContext]="iconContext">
    </template>
  ''',
  directives: const [NgTemplateOutlet],
)
class ExampleComponent {
  Map<String, dynamic> textContext = {
    '\$implicit': 'Hello world!',
  };

  Map<String, dynamic> iconContext = {
    '\$implicit': 'icon.png',
    'w': '16',
    'h': '16',
  };
}
Implemented types
Annotations

Constructors

NgTemplateOutlet(ViewContainerRef _viewContainerRef)

Properties

ngTemplateOutlet TemplateRef
The TemplateRef used to create the embedded view. [...]
@Input(), write-only
ngTemplateOutletContext Map<String, dynamic>
An optional map of local variables to define in the embedded view. [...]
@Input(), write-only
hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

ngDoCheck() → void
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited