-
-
Save mikemunsie/3184005d8afdaec6563e to your computer and use it in GitHub Desktop.
Fixed load issue and icon color display by using JQLite.
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(object.attr("icon"), false, function () { | |
object.find("svg").css("fill", attr.iconFill); | |
}); | |
} | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment