Project

General

Profile

1
/**
2
 * @license
3
 * Copyright Google Inc. All Rights Reserved.
4
 *
5
 * Use of this source code is governed by an MIT-style license that can be
6
 * found in the LICENSE file at https://angular.io/license
7
 */
8
import { ElementRef } from './element_ref';
9
import { EmbeddedViewRef } from './view_ref';
10
/**
11
 * Represents an Embedded Template that can be used to instantiate Embedded Views.
12
 *
13
 * You can access a `TemplateRef`, in two ways. Via a directive placed on a `<ng-template>` element
14
 * (or directive prefixed with `*`) and have the `TemplateRef` for this Embedded View injected into
15
 * the constructor of the directive using the `TemplateRef` Token. Alternatively you can query for
16
 * the `TemplateRef` from a Component or a Directive via {@link Query}.
17
 *
18
 * To instantiate Embedded Views based on a Template, use
19
 * {@link ViewContainerRef#createEmbeddedView}, which will create the View and attach it to the
20
 * View Container.
21
 * @stable
22
 */
23
export declare abstract class TemplateRef<C> {
24
    /**
25
     * The location in the View where the Embedded View logically belongs to.
26
     *
27
     * The data-binding and injection contexts of Embedded Views created from this `TemplateRef`
28
     * inherit from the contexts of this location.
29
     *
30
     * Typically new Embedded Views are attached to the View Container of this location, but in
31
     * advanced use-cases, the View can be attached to a different container while keeping the
32
     * data-binding and injection context from the original location.
33
     *
34
     */
35
    readonly abstract elementRef: ElementRef;
36
    abstract createEmbeddedView(context: C): EmbeddedViewRef<C>;
37
}
(9-9/11)