src/lib/module-application.ts
Properties |
|
Methods |
|
constructor(environment: Env, moduleType: Type
|
|||||||||||||||
|
Defined in src/lib/module-application.ts:18
|
|||||||||||||||
|
Parameters :
|
| Public app |
Type : Ref | null
|
Default value : null
|
|
Inherited from
Application
|
|
Defined in
Application:39
|
| Public config |
Type : ConfigService | null
|
Default value : null
|
|
Inherited from
Application
|
|
Defined in
Application:41
|
| Public Readonly Optional configLoadOptions |
Type : ConfigLoadOptions
|
|
Inherited from
Application
|
|
Defined in
Application:48
|
| Public Readonly environment |
Type : Env
|
|
Inherited from
Application
|
|
Defined in
Application:46
|
| Public logger |
Type : Console | null
|
Default value : null
|
|
Inherited from
Application
|
|
Defined in
Application:40
|
| Public Readonly options |
Type : Config
|
Default value : {} as any
|
|
Inherited from
Application
|
|
Defined in
Application:47
|
| Protected create |
create()
|
|
Inherited from
Application
|
|
Defined in
Application:29
|
|
Returns :
Promise<NgModuleRef<M>>
|
| Protected prepareConfig | ||||||
prepareConfig(config: O)
|
||||||
|
Inherited from
Application
|
||||||
|
Defined in
Application:34
|
||||||
|
Parameters :
Returns :
void
|
| Public after | ||||||
after(fnc: ApplicationAfterFunction<Config | Ref | Env>)
|
||||||
|
Inherited from
Application
|
||||||
|
Defined in
Application:90
|
||||||
|
Parameters :
Returns :
void
|
| Public before | ||||||
before(fnc: ApplicationBeforeFunction<Config | Ref | Env>)
|
||||||
|
Inherited from
Application
|
||||||
|
Defined in
Application:86
|
||||||
|
Parameters :
Returns :
void
|
| Public Async bootstrap |
bootstrap()
|
|
Inherited from
Application
|
|
Defined in
Application:51
|
|
Returns :
any
|
| Protected Async handleAfter | ||||||||||||||||||
handleAfter(app: Ref, logger: Console, config: ConfigService, options: Config, environment: Env)
|
||||||||||||||||||
|
Inherited from
Application
|
||||||||||||||||||
|
Defined in
Application:100
|
||||||||||||||||||
|
Parameters :
Returns :
any
|
| Protected Async handleBefore | ||||||||||||
handleBefore(config: ConfigService, options: Config, environment: Env)
|
||||||||||||
|
Inherited from
Application
|
||||||||||||
|
Defined in
Application:94
|
||||||||||||
|
Parameters :
Returns :
any
|
| Protected Async loadConfig | ||||||
loadConfig(environment: Env)
|
||||||
|
Inherited from
Application
|
||||||
|
Defined in
Application:106
|
||||||
|
Parameters :
Returns :
any
|
| Protected Async prepareEnvironment | ||||||
prepareEnvironment(environment: Env)
|
||||||
|
Inherited from
Application
|
||||||
|
Defined in
Application:110
|
||||||
|
Parameters :
Returns :
any
|
import {
BootstrapOptions,
CompilerOptions,
NgModuleRef,
StaticProvider,
Type,
} from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { ConfigLoadOptions } from '@rxap/config';
import { Environment } from '@rxap/environment';
import { Application } from './application';
export interface ModuleApplicationConfig {
extraProviders?: StaticProvider[] | undefined;
compilerOptions?: (CompilerOptions & BootstrapOptions) | Array<CompilerOptions & BootstrapOptions>;
}
export class ModuleApplication<M, O extends ModuleApplicationConfig, Env extends Environment> extends Application<O, NgModuleRef<M>, Env> {
constructor(
environment: Env,
private readonly moduleType: Type<M>,
options?: O,
configLoadOptions?: ConfigLoadOptions,
) {
super(environment, options, configLoadOptions);
}
protected create(): Promise<NgModuleRef<M>> {
return platformBrowserDynamic(this.options.extraProviders)
.bootstrapModule(this.moduleType, this.options.compilerOptions);
}
protected override prepareConfig(config: O) {
config.extraProviders ??= [];
config.compilerOptions ??= [];
}
}