0

I want to use the simple example dropzone js in an angular 2 project: http://www.dropzonejs.com/examples/simple.html

Is there an easy way to use the js for simple drag and drop functionality? I tried adding installing using:

npm i dropzone --save

And referencing the script from node_modules in index.html, but it doesn't seem to work.

Plunkr: http://plnkr.co/edit/Gk2xtoH1FhOe6hko6z8K?p=preview

1 Answer 1

2

Currently, The easiest way to include an external library into an angular 2 project is as follows:

1) include it in your HTML file as a script tag

<script src="js/your-library.js"></script>

2) To use the library you must add the following to one of your ts/js files:

declare var libraryVar: any;

or

var libraryVar

Where libraryVar is the name of a function from the library you're including, so for example, to include jQuery, you would use:

declare let $:any;
Sign up to request clarification or add additional context in comments.

Comments

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.