angular.module('uiSwitch', []) .directive('switch', function() { return { restrict: 'AE', replace: true, transclude: true, template: function(element, attrs) { var html = ''; html += '' + attrs.on + '' : ''; /*switch text on value set by user in directive html markup*/ html += attrs.off ? '' + attrs.off + '' : ' '; /*switch text off value set by user in directive html markup*/ html += ''; return html; } } });