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 { Injector, NgModuleFactory, OnChanges, OnDestroy, SimpleChanges, Type, ViewContainerRef } from '@angular/core';
9
/**
10
 * Instantiates a single {@link Component} type and inserts its Host View into current View.
11
 * `NgComponentOutlet` provides a declarative approach for dynamic component creation.
12
 *
13
 * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and
14
 * any existing component will get destroyed.
15
 *
16
 * ### Fine tune control
17
 *
18
 * You can control the component creation process by using the following optional attributes:
19
 *
20
 * * `ngComponentOutletInjector`: Optional custom {@link Injector} that will be used as parent for
21
 * the Component. Defaults to the injector of the current view container.
22
 *
23
 * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content
24
 * section of the component, if exists.
25
 *
26
 * * `ngComponentOutletNgModuleFactory`: Optional module factory to allow dynamically loading other
27
 * module, then load a component from that module.
28
 *
29
 * ### Syntax
30
 *
31
 * Simple
32
 * ```
33
 * <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container>
34
 * ```
35
 *
36
 * Customized injector/content
37
 * ```
38
 * <ng-container *ngComponentOutlet="componentTypeExpression;
39
 *                                   injector: injectorExpression;
40
 *                                   content: contentNodesExpression;">
41
 * </ng-container>
42
 * ```
43
 *
44
 * Customized ngModuleFactory
45
 * ```
46
 * <ng-container *ngComponentOutlet="componentTypeExpression;
47
 *                                   ngModuleFactory: moduleFactory;">
48
 * </ng-container>
49
 * ```
50
 * ## Example
51
 *
52
 * {@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}
53
 *
54
 * A more complete example with additional options:
55
 *
56
 * {@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'}
57

    
58
 * A more complete example with ngModuleFactory:
59
 *
60
 * {@example common/ngComponentOutlet/ts/module.ts region='NgModuleFactoryExample'}
61
 *
62
 * @experimental
63
 */
64
export declare class NgComponentOutlet implements OnChanges, OnDestroy {
65
    private _viewContainerRef;
66
    ngComponentOutlet: Type<any>;
67
    ngComponentOutletInjector: Injector;
68
    ngComponentOutletContent: any[][];
69
    ngComponentOutletNgModuleFactory: NgModuleFactory<any>;
70
    private _componentRef;
71
    private _moduleRef;
72
    constructor(_viewContainerRef: ViewContainerRef);
73
    ngOnChanges(changes: SimpleChanges): void;
74
    ngOnDestroy(): void;
75
}
(3-3/9)