# ng-environmenter

> Angular environment sharing done easy

Latest version **0.1.2** (published 2019-01-31) · 0 weekly downloads

## Install

```sh
npm install ng-environmenter
pnpm add ng-environmenter
yarn add ng-environmenter
bun add ng-environmenter
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2019-01-31 |
| First published | 2019-01-16 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 65.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | klauskpm |
| Keywords | angular, environment, ng-environmenter, angular environments |

## Links

- npm: https://www.npmjs.com/package/ng-environmenter
- Repository: https://github.com/klauskpm/ng-environmenter
- Homepage: https://github.com/klauskpm/ng-environmenter#readme
- Issues: https://github.com/klauskpm/ng-environmenter/issues
- npm.io page: https://npm.io/package/ng-environmenter

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.9.0

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 0.1.2 (latest) — 2019-01-31
- 0.1.1 — 2019-01-31
- 0.1.0 — 2019-01-26
- 0.0.7 — 2019-01-25
- 0.0.6 — 2019-01-24
- 0.0.5 — 2019-01-22
- 0.0.4 — 2019-01-22
- 0.0.3 — 2019-01-18
- 0.0.2 — 2019-01-17
- 0.0.1 — 2019-01-16

## README

# ng-environmenter
Angular environment sharing done easy

![](https://img.shields.io/github/issues/klauskpm/ng-environmenter.svg)
![](https://img.shields.io/github/license/klauskpm/ng-environmenter.svg)

## Getting started
Install the package:
`npm install ng-environmenter`

### Environment configuration
Create a `environments` folder at root level of your workspace, and a environment file for each environment, like the following:
```typescript
// environments/environment.ts
export const globalEnvironment = {
  production: false,
};
```

And extend it on yours application environment file:
```typescript
// projects/app/src/environments/environment.ts
import { Environment } from 'ng-environemnter';
import { globalEnvironment } from '../../../../environments/environment.ts';

export const environment: Environment = {
  application: {},
  global: globalEnvironment
};
```

### Implementing the Environmenter
Add it to your AppModule:
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { environment } from '../environments/environment';
import { EnvironmenterModule } from 'ng-environmenter';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    EnvironmenterModule.forRoot(environment)
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
```

And inject the `Environmenter` on any file:
```typescript
import { Component } from '@angular/core';
import { Environmenter } from 'ng-environmenter';

@Component({
  selector: 'app-component',
  template: `
    <p>{{ getEnvironment() | json }}</p>
  `,
})
export class AppComponent {
  constructor(
    private environmenter: Environmenter
  ) {}

  getEnvironment() {
    return [
      this.environmenter.getApplicationEnvironment(),
      this.environmenter.getGlobalEnvironment(),
      this.environmenter.getEnvironment(),
    ];
  }
}
```

---
_Source: https://npm.io/package/ng-environmenter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
