简体   繁体   中英

How to access variable from custom javascript in angular component?

I am working in angular 5 project, and added a javascript custom in assets > js > myfile.js. I created component and want to get that value from myfile.js in my component.ts file.

In your component, below your imports, add this

declare let DiagramEditor: any;

You could even declare it as a Function and specify parameter types.

Then just call that function in your component

DiagramEditor(myConfig, ui, ()=> { /* callback code*/ })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM