Search code examples
javascriptangularjsng-flow

Detect where drop occured (ng-flow)


I am using ng-flow for drag & drop files and upload to server. The page I am developing has multiple drop listeners . Is there a way to detect on which element the drop occurred ?

    <body ng-app="droptest" flow-init="{target:''}"> 
    <div name="drop1" class="fa fa-paperclip fa-rotate-90 Cell small" flow-drop="" title="Drag/Drop files to upload to this record"></div>
 <div name="drop2" class="fa fa-paperclip fa-rotate-90 Cell small" flow-drop="" title="Drag/Drop files to upload to this record"></div>
     </body>

 $scope.$on('flow::fileAdded', function (event, $flow, flowFile) {
   //how to detect whether drop occured on drop1 or drop2?
});

Solution

  • I figured it out

     $scope.$on('flow::fileAdded', function (event, $flow, flowFile, elementDetails) {
                   elementDetails.target 
             });