@buildium/angular-launchdarkly-client
v1.0.0
Published
Angular module for the LaunchDarkly Javascript SDK
Downloads
2
Maintainers
Readme
An AngularJS module for the LaunchDarkly Javascript SDK.
Getting Started
Installing
Available on NPM
npm install @buildium/angular-launchdarkly-client
Usage
After loading the script, add the module to your application dependencies
angular.module('myApp', ['buildium.launchdarkly-client', ...])
Now you will have access to two services
LaunchDarklyClient
is the LaunchDarkly SDK.
LaunchDarklyService
exposes a service to retrieve feature flags.
function Controller(LaunchDarklyService) {
LaunchDarklyService.getFeatureFlag('myfeature', userId).then(function(isEnabled) {
// use flag
})
LaunchDarklyService.getFeatureFlag('myfeature').then(function(isEnabled) {
// use flag for anonymous user
})
}
Before using the service it should be configured with a LaunchDarkly environment id.
.config(function(FeatureFlagServiceProvider) {
LaunchDarklyServiceProvider.setLaunchDarklyEnvironmentId(ENVIRONMENT_ID);
})
Contributing
Running the tests
Tests are run with karma
npm test
Compiling
npm run compile
This will generate the source file, index.js
License
Freely distributable under the terms of the MIT license.