Skip to content

Valetudox/angular2-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Angular2 Config

Coverage Status Build Status

This is a simple config solution for angular2. You should provide the configuration.

Install

npm install --save angular2-config

Setup

provide externalConfig in your bootstrap

provide('config', { useValue: { 
  key1: 'value',
  visibleDropdowns: false,
  nested: {
    key: 'value2'
  }
});

Usage in template

import { ConfigPipe } from 'angular2-config';

@Component({
  selector: '<sub-app>',
  pipes: [ConfigPipe],
  template: `
    <h1>{{ 'nested.key' | config }}</h1>
    <body>
      <dropdown *ngIf="'visibleDropdowns' | config"></dropdown>
      This is a text
    </body>
  `
})
export class App {}

Usage in Controller

import { ConfigService } from 'angular2-config';

@Component({
  selector: '<sub-app>',
  template: `Some content`
})
export class App {

  constructor(configService: ConfigService) {
    console.log(configService.get('nested.key'));
  }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published