angular2-suite-flipper

3.0.1 • Public • Published

Angular2 Suite Flipper

This is a simple flipper solution for angular2. You should provide the flippers.

Install

npm install --save angular2-suite-flipper

Setup

provide flippers in your bootstrap

 
provide('flippers', { useValue: ['dummy', 'test'] });

Usage in template

 
import { IsOnPipe } from 'angular2-suite-flipper';
import { IsOffPipe } from 'angular2-suite-flipper';
 
@Component({
  selector: '<sub-app>',
  pipes: [IsOnPipe, IsOffPipe],
  template: `
    <h1 *ngIf="'dummy' | isOff">With</h1>
    <h1 *ngIf="'dummy' | isOn">Without</h1>
  `
})
export class App {}

Usage in Controller

 
import { FlipperService } from 'angular2-suite-flipper';
 
@Component({
  selector: '<sub-app>',
  template: `Some content`
})
export class App {
 
  constructor(flipperService: FlipperService) {
    if (flipperService.isOn('dummy')) console.log(1);
    if (flipperService.isOff('dummy')) console.log(2);
  }
}

Package Sidebar

Install

npm i angular2-suite-flipper

Weekly Downloads

0

Version

3.0.1

License

ISC

Last publish

Collaborators

  • sviktor