### File

`src/lib/standalone-application.ts`

### Extends

`Application`

### Index

###### Properties
Public app Public config Public Readonly Optional configLoadOptions Public Readonly environment Public logger Public Readonly options
###### Methods
Protected create Public importProvidersFrom Protected prepareConfig Public after Public before Public Async bootstrap Protected Async handleAfter Protected Async handleBefore Protected Async loadConfig Protected Async prepareEnvironment

### Constructor

`constructor(environment: Environment, rootComponent: Type<>, options?: O, configLoadOptions: ConfigLoadOptions)`
Defined in src/lib/standalone-application.ts:13
Parameters :
Name | Type | Optional
environment | `Environment` | No
rootComponent | `Type<>` | No
options | `O` | Yes
configLoadOptions | `ConfigLoadOptions` | No

### Properties

Public app
Type : `Ref | null`
Default value : `null`
Inherited from `Application`
Defined in `Application:35`

Public config
Type : `ConfigService | null`
Default value : `null`
Inherited from `Application`
Defined in `Application:37`

Public Readonly Optional configLoadOptions
Type : `ConfigLoadOptions`
Inherited from `Application`
Defined in `Application:44`

Public Readonly environment
Type : `Environment`
Inherited from `Application`
Defined in `Application:42`

Public logger
Type : `NGXLogger | null`
Default value : `null`
Inherited from `Application`
Defined in `Application:36`

Public Readonly options
Type : `Config`
Default value : `{} as any`
Inherited from `Application`
Defined in `Application:43`

### Methods

Protected create
`create()`
Inherited from `Application`
Defined in `Application:32`
Returns : `Promise<ApplicationRef>`

Public importProvidersFrom
`importProvidersFrom(...sources: ImportProvidersSource[])`
Defined in src/lib/standalone-application.ts:27
Parameters :
Name | Type | Optional
sources | `ImportProvidersSource[]` | No
Returns : `void`

Protected prepareConfig
`prepareConfig(config: O)`
Inherited from `Application`
Defined in `Application:36`
Parameters :
Name | Type | Optional
config | `O` | No
Returns : `void`

Public after
`after(fnc: ApplicationAfterFunction<Ref>)`
Inherited from `Application`
Defined in `Application:86`
Parameters :
Name | Type | Optional
fnc | `ApplicationAfterFunction<Ref>` | No
Returns : `void`

Public before
`before(fnc: ApplicationBeforeFunction<Config>)`
Inherited from `Application`
Defined in `Application:82`
Parameters :
Name | Type | Optional
fnc | `ApplicationBeforeFunction<Config>` | No
Returns : `void`

Public Async bootstrap
`bootstrap()`
Inherited from `Application`
Defined in `Application:47`
Returns : `any`

Protected Async handleAfter
`handleAfter(app: Ref, logger: NGXLogger, config: ConfigService)`
Inherited from `Application`
Defined in `Application:96`
Parameters :
Name | Type | Optional
app | `Ref` | No
logger | `NGXLogger` | No
config | `ConfigService` | No
Returns : `any`

Protected Async handleBefore
`handleBefore(config: ConfigService, options: Config)`
Inherited from `Application`
Defined in `Application:90`
Parameters :
Name | Type | Optional
config | `ConfigService` | No
options | `Config` | No
Returns : `any`

Protected Async loadConfig
`loadConfig(environment: Environment)`
Inherited from `Application`
Defined in `Application:102`
Parameters :
Name | Type | Optional
environment | `Environment` | No
Returns : `any`

Protected Async prepareEnvironment
`prepareEnvironment(environment: Environment)`
Inherited from `Application`
Defined in `Application:106`
Parameters :
Name | Type | Optional
environment | `Environment` | No
Returns : `any`

    import {
      ApplicationConfig,
      ApplicationRef,
      importProvidersFrom,
      ImportProvidersSource,
      Type,
    } from '@angular/core';
    import { bootstrapApplication } from '@angular/platform-browser';
    import { ConfigLoadOptions } from '@rxap/config';
    import { Environment } from '@rxap/environment';
    import { Application } from './application';

    export class StandaloneApplication<O extends ApplicationConfig> extends Application<O, ApplicationRef> {

      constructor(
        environment: Environment,
        private readonly rootComponent: Type<unknown>,
        options?: O,
        configLoadOptions: ConfigLoadOptions = {
          url: `${ environment.origin ?? location.origin }/api/configuration/${ environment.tag ??
          'latest' }/${ environment.app }`,
        },
      ) {
        super(environment, options, configLoadOptions);
      }

      public importProvidersFrom(...sources: ImportProvidersSource[]) {
        this.options.providers ??= [];
        this.options.providers.push(importProvidersFrom(...sources));
      }

      protected create(): Promise<ApplicationRef> {
        return bootstrapApplication(this.rootComponent, this.options);
      }

      protected override prepareConfig(config: O) {
        config.providers ??= [];
      }

    }

# results matching ""

# No results matching ""