User283571144 posted
Hi comicrage,
If you want to add custom chart.js into your angular project, I suggest you could refer to below steps:
Step: 1=> Copy your custom "Chart.js" in /app folder.
For exmaple: You add below codes in it:
export function synapseThrow() {
return 'hello'
}
export const MY_VAR = 'world!';
Step: 2=> in angular.json, add the below part in apps object.
"scripts": ["app/Chart.js"]
Step: 3=> in tsconfig.json, add the below property in compilerOptions.
"allowJs": true
Step: 4=> in any component say in "app.component.ts" import the "chart.js" file using importkeyword.
app.component.ts
// other imports
import { MY_VAR, synapseThrow } from './chart';
// other app code here
ngOnInit(){
const returned = MY_VAR;
const returnFunc = synapseThrow();
}
Result:
The VScode doesn't show any mistake:

Best Regards.
Brando