1.0.1 • Published 9 years ago

angular-live-or-test v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

angular-live-or-test Build Status

Angular service and directive for toggling and indicating "live" and "test" modes. If you've ever used Stripe, you've seen how you can toggle between "live" and "test" from your dashboard. In test mode, the dashboard displays a badge reminding the user that they're in test mode. This allow you to replicate that effect.

Stripe test badge

Installing

$ npm install angular-live-or-test

Setup

angular.module('myApp', [
  require('angular-live-or-test')
]);

API

Service: live

live.enabled([Boolean]) -> Boolean

When either true or false is passed, live mode is enabled or disabled, respectively. If no argument is passed, the current setting is returned. live is a singleton. Your application can only have one live setting.

Directive: testBadge

Displays a badge that is synced to the live mode setting.

<test-badge>
  <h2>Test</h2>
</test-badge>