Skip to content

Knockout Binding Handler for the bootstrap-toggle plugin.

License

Notifications You must be signed in to change notification settings

aAXEe/knockout-bootstrap-toggle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

knockout-bootstrap-toggle

Knockout Binding Handler for the bootstrap-toggle plugin.

Install

Bower

bower install knockout-bootstrap-toggle

Usage

Include the javascript file in your html:

<script src="/bower_components/knockout/dist/knockout.js"></script>
<script src="/bower_components/bootstrap-toggle/js/bootstrap-toggle.js"></script>
<script src="/bower_components/knockout-bootstrap-toggle/ko.bindingHandlers.bootstrapToggle.js"></script>

Add an bootstrapToggle data binding to the checkbox:

<input type="checkbox" data-toggle="toggle" data-bind="bootstrapToggle: wantsSpam" />

Use like a normal checkbox (http://knockoutjs.com/documentation/checked-binding.html)

 var viewModel = {
     wantsSpam: ko.observable(true) // Initially checked
 };

 // ... then later ...
 viewModel.wantsSpam(false); // The checkbox becomes unchecked

About

Knockout Binding Handler for the bootstrap-toggle plugin.

Resources

License

Stars

Watchers

Forks

Packages

No packages published