Skip to content

Instantly share code, notes, and snippets.

@joaoneto
Created October 27, 2014 20:42
Show Gist options
  • Save joaoneto/89d51acfea17e771abf6 to your computer and use it in GitHub Desktop.
Save joaoneto/89d51acfea17e771abf6 to your computer and use it in GitHub Desktop.
material.components.icon.extra
/**
* Markup
* <md-icon icon-fill="red" icon="'/img/icons/test.svg'" style="width: 32px; height: 32px;"></md-icon>
*/
angular.module('material.components.icon.extra', [
'ngMaterial'
])
.directive('iconFill', function () {
return {
restrict: 'A',
link: function(scope, element, attr) {
var object = angular.element(element[0].children[0]);
if(angular.isDefined(attr.iconFill)) {
object.load(function () {
var svg = angular.element(this.getSVGDocument().documentElement);
svg.attr('fill', attr.iconFill);
});
}
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment