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.

3
  • share your code snippet Commented Dec 15, 2016 at 1: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. Commented Dec 15, 2016 at 1: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? Commented Dec 15, 2016 at 8:03

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.