Simple 2 or 3 states angular button using fontawesome fa-toggle icon.
Here an example: https://jsfiddle.net/adidoo/90e1q6wd/2/
Install with bower:
bower install angular-mt-toggleAdd a <link> to your index.html header:
<link rel="stylesheet" href="/bower_components/css/font-awesome.min.css">Add a <script> to your index.html:
<script src="/bower_components/angular/angular.js"></script>
<script src="/bower_components/angular-mt-toggle/angular-mt-toggle.js"></script>Call angular-mt-toggle directive in your html file:
<angular-mt-toggle data-ng-model="selector"></angular-mt-toggle>Where selector is defined in the scope.
Can add:
type="number" in order to switch a number between 0 and 1
three-states=aValue in order to have a 3 states switch (true / false / aValue)
aValue can be any thing, even null. If undefined is needed, use "undefined":
<angular-mt-toggle data-ng-model="selector" data-three-states="undefined"></angular-mt-toggle>If the two options are set, values will be 1, 0 and aValue.
Ex:
<angular-mt-toggle data-ng-model="selector" data-type="number" data-three-states=null></angular-mt-toggle>The MIT License
Copyright (c) 2010-2012 Google, Inc. http://angularjs.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.