Chartjs-How to create an angular 7 component?

3👍

If you have the angular CLI installed you can create a component using the command:

ng generate component <component-name or folder>

Here is a link to the official Angular CLI documentation

Once you have the component generated it should be relatively straight forward to drop the html, css and js code into the corresponding files.

To setup a variable as an input parameter, annotate it with @Input() acoptions in your component class.

Link to angular input documentation

One more note, you may want to create an interface for acoptions since it is a fairly complicated data object, with layers. This will also add some fidelity to your code.

Leave a comment