-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Expand file tree
/
Copy pathng_module_factory.ts
More file actions
61 lines (54 loc) · 1.8 KB
/
ng_module_factory.ts
File metadata and controls
61 lines (54 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Injector} from '../di/injector';
import {EnvironmentInjector} from '../di/r3_injector';
import {Type} from '../interface/type';
/**
* Represents an instance of an `NgModule` created by an `NgModuleFactory`.
* Provides access to the `NgModule` instance and related objects.
*
* @publicApi
*/
export abstract class NgModuleRef<T> {
/**
* The injector that contains all of the providers of the `NgModule`.
*/
abstract get injector(): EnvironmentInjector;
/**
* The `NgModule` instance.
*/
abstract get instance(): T;
/**
* Destroys the module instance and all of the data structures associated with it.
*/
abstract destroy(): void;
/**
* Registers a callback to be executed when the module is destroyed.
*/
abstract onDestroy(callback: () => void): void;
}
export interface InternalNgModuleRef<T> extends NgModuleRef<T> {
// Note: we are using the prefix _ as NgModuleData is an NgModuleRef and therefore directly
// exposed to the user.
_bootstrapComponents: Type<any>[];
resolveInjectorInitializers(): void;
}
/**
* @publicApi
*
* @deprecated
* This class was mostly used as a part of ViewEngine-based JIT API and is no longer needed in Ivy
* JIT mode. Angular provides APIs that accept NgModule classes directly (such as
* [PlatformRef.bootstrapModule](api/core/PlatformRef#bootstrapModule) and
* [createNgModule](api/core/createNgModule)), consider switching to those APIs instead of
* using factory-based ones.
*/
export abstract class NgModuleFactory<T> {
abstract get moduleType(): Type<T>;
abstract create(parentInjector: Injector | null): NgModuleRef<T>;
}