Angular Directive for Bootstrap-Switch

25 July, 2014

Have you seen the Bootstrap Switch? If not, check it out:


Angular Directive

Once you’ve added bootstrap-switch to your project, simply add this directive to your app.js or controller.


<input type="checkbox" ng-model="mymodel.mystate" bootstrap-switch />

WARNING I can’t stress this enough:

“Always use a dot in your ng-model”

  • A war-torn, battle-scarred, mentally-exhausted person who didn’t do exactly this

Scoping and binding are potentially screwed if you don’t. It is a difficult problem to find and understand.

Further reading is required: