1👍
✅
You need a directive
like:
app.directive('graph', [function() {
return {
restrict: 'A',
scope: {
x: '@',
y: '@',
width: '@',
height: '@'
},
template: '' // Your code to draw the graph.
};
}]);
In this way, you can reuse the directive in multiple place, by changing the parameters:
<div graph width="100" height="200"></div>
<div graph width="500" height="1000"></div>
......
Source:stackexchange.com