Socket
Socket
Sign inDemoInstall

angular-ui-switch

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    angular-ui-switch

iOS 7 style switch directive for AngularJS


Version published
Weekly downloads
6.6K
decreased by-11.44%
Maintainers
1
Install size
26.2 kB
Created
Weekly downloads
 

Readme

Source

angular-ui-switch

This is a simple iOS 7 style switch directive for AngularJS. You can use this module as you would use the default HTML checkbox input element. This is a super lightweight module and you can completely change the design using just CSS.

Supported by all modern browsers: Chrome, Firefox, Opera, Safari, IE8+

YoomJS

Inspired by switchery - in angular way.

Installation

Download the package from github. The package is also available over npm install angular-ui-switch or bower install angular-ui-switch.

Include javascript and css files into your page.

<!DOCTYPE html>
<html lang="en" ng-app="app">
<head>
  ...
  <link rel="stylesheet" href="/ui-switch.min.css"/>
</head>
<body>
  ...
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-rc.3/angular.min.js"></script>
  <script src="/ui-switch.min.js"></script>
</body>
</html>

Declare a dependency on the module.

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

Insert the switch in your html template.

<form>
  <switch id="enabled" name="enabled" ng-model="enabled" class="green"></switch>
  <br>{{ enabled }}
</form>

Add optional on/off text

<form>
  <switch id="enabled" name="enabled" ng-model="enabled" on="On" off="Off" class="green"></switch>
  <br>{{ enabled }}
</form>

Disabled state

<form>
  <switch id="enabled" name="enabled" ng-model="enabled" disabled="true" class="green"></switch>
  <br>{{ enabled }}
</form>

Design

You can completely change the design. All the magic is hidden inside two CSS classes.

.switch {
  /* frame */
}
.switch small {
  /* button */
}
.switch.checked {
  /* frame when enabled */
}
.switch.checked small {
  /* button when enabled */
}

Publishing

  1. Update version in package.json and bower.json.

  2. Run make compile to minify files.

  3. Run make publish to publish.

Keywords

FAQs

Last updated on 15 Sep 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc