2

I want to know if it's possible to load a script.js into a Typescript html template in angular2? If it's not possible, how can I do and what alternatives I have? In my project, I need to call a dropzone.js script into the template dropzone.component.html. It doesn't work when I load it from this file. So how can I do if I don't want to put the script into index.html?? Thank you.

Venkat.R
  • 7,420
  • 5
  • 42
  • 63
amin89
  • 558
  • 1
  • 8
  • 26
  • share your code snippet – Venkat.R Dec 15 '16 at 01:15
  • 1
    If your script is in a module format (AMD, CommonJS etc.) you can dynamically (lazy) load the script with a module loader such as SystemJS. – Michael McGowan Dec 15 '16 at 01:57
  • I want to use dropzone.js (A library to drag and drop file with upload on server side) into an angular2 project. I have a SPA and I don't want to put the reference to the script in the html page index. What's the alternatives so? – amin89 Dec 15 '16 at 08:03

1 Answers1

2

You can reference this question here, I do not believe it is possible to put a script tag inside of an angular 2 template.

angular2: including thirdparty js scripts in component

Community
  • 1
  • 1
  • I want to use dropzone.js (A library to drag and drop file with upload on server side) into an angular2 project. I have a SPA and I don't want to put the reference to the script in the html page index. What's the alternatives so? – amin89 Dec 15 '16 at 08:03