I'm new to angular and typescript, so this is probably really basic.
I'm trying to make an angular2 component with a chart (using Chart.js) in the template.
I realize there is a chart directive being developed, that specifically uses Chart.JS, but I would like to understand how to do this, as it will undoubtedly come up in an instance where a directive isn't available.
So far I've tried to do this simple thing in the template:
<canvas id="chart"></canvas>
<script>
$(function () {
//instantiate chart on $("#chart")
});
</script>
But this javascript doesn't even run when the template has been loaded by angular2.
How would I go about this?
Okay - with the help of @Pogrindis I think I found a usable, not too complex solution.
By simply adding the typing definition for chart.js from here and referencing it in a custom directive I finally have this:
chart.directive.ts
app.component.ts
and template.html: