ngx-feature-toggle7.0.2 • Public • Published
NGX Feature Toggle
Your module to handle with feature toggles in Angular applications easier.
Why Feature toggle?
This is a common concept, but why use this directive instead solve it via server-side rendering?
The idea of this directive is make this process transparent and easier. So the main point is integrate this directive with other tooling process, such as:
- Server-side rendering;
- Progressive rendering;
- Any other that you like :)
You can integrate with WebSockets or handling this in a EventSourcing architecture. It's totally transparent for you and you can integrate easier in your application.
You can get it on NPM installing
ngx-feature-toggle module as a project dependency.
npm install ngx-feature-toggle --save
You'll need to add
FeatureToggleModule to your application module. So that, the
featureToggle components will be accessible in your application.
Now you just need to add a configuration in your application root component. Your feature toggle configuration can be added using different approaches, such as:
- RXJS subscribe information;
- HTTP Request;
- CQRS event data;
- File information;
After that, you can use the
featureToggle components and directives in your templates, passing the string based on the feature toggle configuration data.
feature-toggle-provider: Handle with feature toggle configuration in your application. It adds the default values of your enabled/disabled features;
*featureToggle: Directive that handles with feature toggle check. So that, the component will be rendered/removed based on the feature toggle configuration is enabled;
*featureToggleWhenDisabled: Directive that handles with feature toggle check. So that, the component will be rendered/removed when the feature toggle configuration is disabled;
Run demo locally
- This project uses Angular CLI as base. That means you just need to run
npm startand access the link
http://localhost:4200in your browser
npm testfor run tests. In case you want to test using watch, please use
npm run tdd
this project is using
np package to publish, which makes things straightforward. EX:
np <patch|minor|major> --contents=dist/ngx-feature-toggle
For more details, please check np package on npmjs.com
Wilson Mendes (willmendesneto)