ng-flips
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

ng-flips

Angular module to use feature switches, configurable through environment variables, or api, packaged with Angular CLI version 6.0.3.

Usage

Install

$ npm install ng-flips --save

Import and configure

// ...
import { NgFlipsModule, NgFlipsComponent, FlipsConfig } from 'ng-flips';
import {environment} from '../environments/environment';
// ...
import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    NgFlipsModule.forRoot(environment, <FlipsConfig>{json: {features: [{feature: "hello", switchedOn: true}]}})
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

place the NgFlipsModule in your modules imports array, and inject the environment setup, and Flips configuration to the forRoot method. Check the Angular guide how environments should work.

then in your template in any component:

<ng-flips [onFeature]="'hello'"> 
    <p> Hi! </p>
    <p fallback> Bye </p>
</ng-flips>

wrap your feature into an ng-flips element give the flag name to the onFeature attribute. If you have the named feature enabled the child elements will show up, otherwise not. If you specify any dom element with the fallback attribute, that will work as an else statement.

Tip

Try to structure your app to separate modules so you can have more different configs not one big global one.

Readme

Keywords

none

Package Sidebar

Install

npm i ng-flips

Weekly Downloads

0

Version

0.0.2

License

none

Unpacked Size

180 kB

Total Files

42

Last publish

Collaborators

  • mcraa