Sunday, 15 April 2012

Dropzone becomes inactive when used in AngularJS ng-view -


I have a controller that displays images through a template that is passed through ng-view It's easy to run and I have dropzone too and it's running and is working smoothly. However, as soon as I add the drop zone to the template, the dropzone is no longer active, it displays (unless I manually add dz-clickable, but there is still nothing, the area is not clicked. is).

I can add drop zones to an NG-covered area above the area and it is hidden when the template is looking elsewhere but I have heard that more processors than NG-NG-NG-NAP So it will be liked to keep it all together.

I have noticed that a dandjone is an angular instruction, but it is not successful in merging it with my controller which is kept in NG-view or if it will be successful too?

> Directive: Directive:

  (function () {angular.module ('dropZone', []). Directive ('dropZone', function () {return Function (scope, element, attrs) {element.dropzone ({url: "/ upload", maxFilesize: 100, paramName: "uploadfile", maxThumbnailFilesize: 5, init: function () {scope.files.push ({file: 'Added'}); // works here ('success', function (file, jsn) {}); (on '' added file '', function (file) {radius $ apply (function () {Warning (file); scope .files.push ({file: 'added'});});}); this.on ('drop', function (file) {alert ('file');} }}}}};}});} ());  

And here's my current controller:

  (function () {'strict use'; angular module ('app'). ('Custom Controller', Custom Controller. $ Injection = ['API']; Function Custom Controller (API) {var vm = this; APIGet Design (). Then (function (data) {vm.designs = data; }}}}} ());  

got your own answer. Instead of adding hard-dropping zones, just go to the programmatic Dropzone was added within the controller scope function:

  var myDropzone = new Dropzone ("div # myId", {url: "/ file / post"});  

No comments:

Post a Comment