FlowJS example to loop through files in Angular controller

428 views Asked by At

Does anyone have an example on how to access the $flow object in an angularJS controller? I need to iterate through the files after the end user clicks a submit button before they're uploaded.

I've tried passing the $flow object from the front end...

<button class="btn btn-success btn-block" type="button" ng-click="ok($flow)">Save Submission</button>

And attempting to access it from the back end directly...

angular.forEach($scope.$flow.files, function (file, index) {
  // do something
}

The $flow object is always undefined.

1

There are 1 answers

0
David Poindexter On

We have had trouble accessing $flow in $scope as well (though in theory that should work), so I recommend setting the following on the DIV:

<div flow-name="uploader.flow" ...> </div>

Then you can access in the Angular controller via something like the following:

$scope.uploader.flow.files[i].