Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'd like to use Dropzone.js in application which is built with Backbone and Require.JS, but I have no idea how to implement it.

Should I use require()?

What is the most skillful way to manage it?

Edit:

I've treid to use dropzone-amd-module in on of my backbone view module like this:

define([
  'jquery',
  'underscore',
  'backbone',
  'dropzone'
  ], function($, _, Backbone, Dropzone){

var NewProduct = Backbone.View.extend({
  el: $('.products'),
  render: function(){

      $(this).empty();
      require(['text!templates/product_new.html'], function(product_new){
        var product_new = _.template(product_new);
        $('.products').html(product_new);
      }); 

      Dropzone.forElement("#my-awesome-dropzone").on("addedfile", function(file) {
        console.log("uploaded");
      });

    }
  });

return NewProduct;
});

Using this HTML in template:

<form action="/upload'" class="dropzone" id="my-awesome-dropzone" method="POST" enctype="multipart/form-data">
    <input type="file" name="file" />
  </form>

But nothing happened.

share|improve this question
Do you use requirejs in the rest of your project? There's no such such thing as "most skillful". It's always a matter of how your project is setup. If you do want to use require, dropzone seems to have support for that – Dogoku Aug 6 at 9:23
look at currently edited question – ladislav_prague Aug 6 at 12:11
still not working at all.. please help me, anybody – ladislav_prague Aug 6 at 16:13
seems it doesn't work only in chrome stable – ladislav_prague Aug 6 at 18:22

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.