0

When I write native HTML file, I can include this script that include uids object

<script src="https://rawgit.com/cornerstonejs/cornerstoneWADOImageLoader/master/examples/dicomfile/uids.js"></script>

Then I can use this uids referenced from script, like in this line

uids[value];

but how can I use this script in Angular? I put the script tag in index.html, then when I try to use uids in app.component.ts, it doesn't recognize it; saying Cannot find name 'uids'.ts

any idea?

zyydoosh
  • 387
  • 2
  • 14
  • 1
    Does this answer your question? https://stackoverflow.com/questions/44817349/how-do-i-include-a-javascript-script-file-in-angular-and-call-a-function-from-th – Merna Mustafa Nov 21 '21 at 18:14
  • I'm sorry, it works in case the script file is local only, but in my case it didn't work since it's an online script! – zyydoosh Nov 21 '21 at 19:46
  • Maybe this can help https://stackoverflow.com/questions/34489916/how-to-load-external-scripts-dynamically-in-angular – Merna Mustafa Nov 21 '21 at 20:00
  • 1
    is your issue that object is not accessible or typescript giving error. if you have included the script in index.html all you need is to declare the variable so that typescripts compiles e.g. `declare var uuids: any` at the top of .ts file. – Suresh Nagar Nov 22 '21 at 00:00

0 Answers0