Created
October 8, 2013 10:10
-
-
Save hitautodestruct/6882549 to your computer and use it in GitHub Desktop.
Angularjs directive for simplifying bootstrap buttons.
Removes the need to add a `class="btn btn-lg btn-success"` etc. http://jsbin.com/ibinASA/1/edit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = angular.module('boostrapButton', []); | |
app.directive('btn', function () { | |
return function ( scope, element, attrs ) { | |
var classes = attrs.btn.split(' '); | |
classes.unshift('btn'); | |
element.addClass( classes.join(' btn-') ); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works like this: