servergrove / NgSwitchery

An AngularJS Directive for Switchery
MIT License
87 stars 49 forks source link

NGSwitchery

An AngularJS Directive for Switchery.

Usage

  1. Include switchery/dist/switchery[.min].css from your vendors/components folder in your links.
  2. Include switchery/dist/switchery[.min].js from your vendors/components folder in your scripts.
  3. Include ng-switchery.js in your scripts
  4. Declare a dependency on the NgSwitchery module
  5. Add the ui-switch attribute to a checkbox.

Example

Declare a dependency on the module

angular.module('myModule', ['NgSwitchery']);

Insert checkbox html

<input type="checkbox" class="js-switch" ui-switch checked />

Setting Options

<input type="checkbox" class="js-switch" ui-switch="{color: '#E43B11', secondaryColor: '#F89279'}" />

Disable switch

<input type="checkbox" class="js-switch" ui-switch ng-disabled="isDisabled" />

Bower install

bower install ng-switchery

Alternative

You may also wish to look at how to achieve this with pure CSS.

Notice on Version

This project is still in its very early stages and should not be considered production ready.

At this time we are no longer using this project, but will continue to maintain it until someone else agrees to take over. This means that updates will be slow as this is not a priority for us. New releases will be made as our team has time to volunteer to the project.