ng2-feature-flag
A 'feature flag' (or Feature Toggle) is the ability to turn features (sub-sections) of your application on/off with some conditions. The Feature that is being wrapped around the tag is not rendered. This module provides 3 possible variables to turn on/off a feature: language, country and userRole. You can use the conditions that you need, and it will map this to the configuration file.
The module was tested with Angular2 RC6.
Please, let me know about if this module is usefull, any feedback is welcome. I.e: new attributes for the conditions. If you are integrating this in your project, I will be very happy to help with that.
Usage
You can use also: country, userRole and language, this should map against the provided configuration
<feature-flag feature="frenchMessage" language="EN" country="AR" userRole="admin">
configuration (example on a shared module, to reuse the feature flag)
// main module; // feature flags configuration; @ static : ModuleWithProviders return ngModule: SharedModule providers: provide: 'featureFlags' useValue: Features ;
features flags config file. I.e.: ./config/features.config
This file maps a feature with it's conditions to be shown
const Features = "navbar" : "country" : "AR""BR" "language" : "ES" "userRole" : "user" "frenchMessage" : "language" : "fr" ;
Install from npm
npm install ng2-feature-flag --save
Todos:
- unit tests
- build system with gulp
- implement better change detection strategy