This package has been deprecated

Author message:

Moved to @vendasta/core

@vendasta/environment-service
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Environment Service

This provides a service for other components to use to retrieve environment information.

Requirements

The Environment Service interface:

export interface EnvironmentServiceInterface {
    getEnvironment(): Environment;
}

To implement the interface make a new service that implements the interface:


import {EnvironmentServiceInterface, Environment} from '@vendasta/environment-service';

@Injectable()
export class EnvironmentService implements EnvironmentServiceInterface {
  
  getEnvironment(): Environment {
    // Implement how the project determine which environment to run in.
  }
}

Next you will need to provide your service as that interface (generally in app.module.ts)

import { EnvironmentService } from './environment.service';
import { EnvironmentServiceInterfaceToken } from '@vendasta/environment-service';

@NgModule({
  
  providers: [
    EnvironmentService, {provide: EnvironmentServiceInterfaceToken, useExisting: EnvironmentService}
  ],
})
  • Note: To be able to inject an interface, you will have to provide the InjectionToken and not the interface itself (EnvironmentServiceInterfaceToken vs EnvironmentServiceInterface).

Readme

Keywords

none

Package Sidebar

Install

npm i @vendasta/environment-service

Weekly Downloads

1

Version

1.0.2

License

ISC

Last publish

Collaborators

  • vendasta