ng-dropzone icon indicating copy to clipboard operation
ng-dropzone copied to clipboard

Dropzone is not a constructor

Open shadrackkip opened this issue 7 years ago • 7 comments

i get above error,i cant figure out where could be the problem

shadrackkip avatar Oct 21 '17 09:10 shadrackkip

If you ware using Dropzone with npm or webpack, please use this package https://www.npmjs.com/package/angular2-dropzone-wrapper

thatisuday avatar Oct 21 '17 11:10 thatisuday

Is this not for AngularJS? That link is for Angular 2...

Are you interested in a pull request if I convert this to TypeScript?

drewpayment avatar Nov 13 '17 20:11 drewpayment

I have the same issue on AngularJS.

shadrackkip : Have you solved your problem ?

sebk69 avatar Feb 20 '18 17:02 sebk69

Found solution for me : the jquery dropzone must be instanciated before your AngularJS vendor

sebk69 avatar Feb 21 '18 10:02 sebk69

@sebk69 can you provide an example of instantiating your jquery dropzone before your AngularJS vendor?

jmahicks avatar Feb 22 '18 19:02 jmahicks

@jmahicks You need add the js file like this

<!--Drop Zone-->
<script src="~/js/plugin/dropzone/dropzone.min.js"></script>

<!--Angular Js-->
<script src="~/js/plugin/angular/angular.min.js"></script>

zulander1 avatar Mar 19 '18 16:03 zulander1

I just added dropzonejs (www.dropzonejs.com) to my yarn/bower and loaded the dropzone/dist/dropzone files into application.js and application.css before the ng-dropzone files and it worked. I didn't need to create an instance while loading the screen. Example: package.json:

    "dropzone": "^ 5.5.0",
    "ngdropzone": "^ 2.0.2"

application.js

  // = require dropzone / dist / dropzone
  // = require ngdropzone / dist / ng-dropzone
  // = require ngdropzone / dist / ng-dropzone.min

application.css

   * = require dropzone / dist / dropzone
   * = require ngdropzone / dist / ng-dropzone

app.js (angular.module)

angular.module ('app', [
  'thatisuday.dropzone'
]

on your controller js

 vm.dropzoneOptions = {
      url: '/ api / admin / galleries / save-images? gallery_id =' + vm.galeria.id,
      paramName: 'file',
      acceptedFiles: 'image / *',
      addRemoveLinks: true
    }

    vm.dropzoneCallbacks = {
      'addedfile': function (file) {
        console.log ('callback file', file)
      // $ scope.newFile = file
      },
      'success': function (file, xhr) {
        console.log (file, xhr)
      }
    }

    vm.dropzoneMethods = {}

    function removeFile () {
      console.log ('VM and SCOPE', vm, $ scope)
    // $ scope.dzMethods.removeFile ($ scope.newFile); // We got $ scope.newFile from 'addedfile' event callback
    }

in your html file

<div id = "myDropzone" class = "grid-12 form dropzone" options = "vm.dropzoneOptions"
                    callbacks = "vm.dropzoneCallbacks" methods = "vm.dropzoneMethods" ng-dropzone> </div>

saferodrigo avatar Nov 18 '19 14:11 saferodrigo