Skip to content

Instantly share code, notes, and snippets.

@arekbartnik
Forked from snapjay/gist:5f659bb1b491c8fb2441
Last active August 29, 2015 14:15
Show Gist options
  • Save arekbartnik/a275f2f3c1b3a0ba37d3 to your computer and use it in GitHub Desktop.
Save arekbartnik/a275f2f3c1b3a0ba37d3 to your computer and use it in GitHub Desktop.
'use strict';
angular.module('ngSvg', [])
.directive('usesvg', [function(){
return {
restrict : 'E',
replace: true,
controller : ['$scope', function($scope){
}],
scope: {
useid:'@'
},
template: '<svg><use xlink:href=""/> </svg>',
link:function(scope, svg, attrs){
svg.attr('viewBox', document.getElementById(attrs.useid).getAttribute('viewBox'));
svg.children().attr('xlink:href', '#' + attrs.useid);
}
};
}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment