@buildium/angular-launchdarkly-client

1.0.0 • Public • Published

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.

Package Sidebar

Install

npm i @buildium/angular-launchdarkly-client

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • buildium