1 |
49598
|
stefanos.g
|
/**
|
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 { ChangeDetectorRef } from '../change_detection/change_detection';
|
9 |
|
|
import { Injector } from '../di/injector';
|
10 |
|
|
import { Type } from '../type';
|
11 |
|
|
import { ElementRef } from './element_ref';
|
12 |
|
|
import { NgModuleRef } from './ng_module_factory';
|
13 |
|
|
import { ViewRef } from './view_ref';
|
14 |
|
|
/**
|
15 |
|
|
* Represents an instance of a Component created via a {@link ComponentFactory}.
|
16 |
|
|
*
|
17 |
|
|
* `ComponentRef` provides access to the Component Instance as well other objects related to this
|
18 |
|
|
* Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
|
19 |
|
|
* method.
|
20 |
|
|
* @stable
|
21 |
|
|
*/
|
22 |
|
|
export declare abstract class ComponentRef<C> {
|
23 |
|
|
/**
|
24 |
|
|
* Location of the Host Element of this Component Instance.
|
25 |
|
|
*/
|
26 |
|
|
readonly abstract location: ElementRef;
|
27 |
|
|
/**
|
28 |
|
|
* The injector on which the component instance exists.
|
29 |
|
|
*/
|
30 |
|
|
readonly abstract injector: Injector;
|
31 |
|
|
/**
|
32 |
|
|
* The instance of the Component.
|
33 |
|
|
*/
|
34 |
|
|
readonly abstract instance: C;
|
35 |
|
|
/**
|
36 |
|
|
* The {@link ViewRef} of the Host View of this Component instance.
|
37 |
|
|
*/
|
38 |
|
|
readonly abstract hostView: ViewRef;
|
39 |
|
|
/**
|
40 |
|
|
* The {@link ChangeDetectorRef} of the Component instance.
|
41 |
|
|
*/
|
42 |
|
|
readonly abstract changeDetectorRef: ChangeDetectorRef;
|
43 |
|
|
/**
|
44 |
|
|
* The component type.
|
45 |
|
|
*/
|
46 |
|
|
readonly abstract componentType: Type<any>;
|
47 |
|
|
/**
|
48 |
|
|
* Destroys the component instance and all of the data structures associated with it.
|
49 |
|
|
*/
|
50 |
|
|
abstract destroy(): void;
|
51 |
|
|
/**
|
52 |
|
|
* Allows to register a callback that will be called when the component is destroyed.
|
53 |
|
|
*/
|
54 |
|
|
abstract onDestroy(callback: Function): void;
|
55 |
|
|
}
|
56 |
|
|
/**
|
57 |
|
|
* @stable
|
58 |
|
|
*/
|
59 |
|
|
export declare abstract class ComponentFactory<C> {
|
60 |
|
|
readonly abstract selector: string;
|
61 |
|
|
readonly abstract componentType: Type<any>;
|
62 |
|
|
/**
|
63 |
|
|
* selector for all <ng-content> elements in the component.
|
64 |
|
|
*/
|
65 |
|
|
readonly abstract ngContentSelectors: string[];
|
66 |
|
|
/**
|
67 |
|
|
* the inputs of the component.
|
68 |
|
|
*/
|
69 |
|
|
readonly abstract inputs: {
|
70 |
|
|
propName: string;
|
71 |
|
|
templateName: string;
|
72 |
|
|
}[];
|
73 |
|
|
/**
|
74 |
|
|
* the outputs of the component.
|
75 |
|
|
*/
|
76 |
|
|
readonly abstract outputs: {
|
77 |
|
|
propName: string;
|
78 |
|
|
templateName: string;
|
79 |
|
|
}[];
|
80 |
|
|
/**
|
81 |
|
|
* Creates a new component.
|
82 |
|
|
*/
|
83 |
|
|
abstract create(injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: string | any, ngModule?: NgModuleRef<any>): ComponentRef<C>;
|
84 |
|
|
}
|