Here's how this might look as a directive...
restrict: 'E'
: This directive is used as an elementx: '=':
property on the isolated scope passed in as an attribute- template is the template
.
app.directive('myPath', function () {
return {
restrict: 'E',
scope: {
x: '='
},
template: '<svg width="100" height="100"><path ng-attr-d="M{{x}},10L50,50L10,50Z"/></svg>'
};
});
And it can be used like this...
<my-path x="x"></my-path>