1👍
✅
under the link
property.
<script>
angular.module('app')
.directive('ngChart', function(){
return {
restrict: 'E',
link: function (scope, element, attrs, controllers) {
//your plugin implementation here
data = {...} // dictionary of chart data, omitted for brevity
options = {...} // dictionary of chart options, same^
var ctx = element.getContext("2d");
var chart = new Chart(ctx).Line(data, options);
}
template: '<canvas></canvas>'
}
)
</script>
Source:stackexchange.com