title: FlowJS example to loop through files in Angular controller
body: <p>Does anyone have an example on how to access the <code>$flow</code> object in an angularJS controller?  I need to iterate through the files after the end user clicks a submit button before they're uploaded.  </p>
  
  <p>I've tried passing the <code>$flow</code> object from the front end...</p>
  
  <pre><code>&lt;button class="btn btn-success btn-block" type="button" ng-click="ok($flow)"&gt;Save Submission&lt;/button&gt;
  </code></pre>
  
  <p>And attempting to access it from the back end directly...</p>
  
  <pre><code>angular.forEach($scope.$flow.files, function (file, index) {
    // do something
  }
  </code></pre>
  
  <p>The $flow object is always undefined.</p>