Skip to content

Instantly share code, notes, and snippets.

@urish
Created July 7, 2013 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save urish/5943617 to your computer and use it in GitHub Desktop.
Save urish/5943617 to your computer and use it in GitHub Desktop.
Stylesheet Directive for Angular.js
'use strict';
angular.module('myApp')
.directive('styleSheet', function () {
return {
restrict: 'EA',
template: '<style type="text/css" />',
transclude: true,
replace: true,
controller: function($scope, $element, $transclude) {
$element.append($transclude().contents());
}
};
});
<div style-sheet>
.content {
color: {{colors.textColor}};
}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment