Created
October 27, 2014 20:42
-
-
Save joaoneto/89d51acfea17e771abf6 to your computer and use it in GitHub Desktop.
material.components.icon.extra
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
/** | |
* 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