@buildium/angular-launchdarkly-client

Angular module for the LaunchDarkly Javascript SDK

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@buildium/angular-launchdarkly-client
Minified + gzip package size for @buildium/angular-launchdarkly-client in KB

Readme

MIT License

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.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.