flowjs / ng-flow

Flow.js html5 file upload extension on angular.js framework
http://flowjs.github.io/ng-flow/
MIT License
1.38k stars 303 forks source link

$scope.$on('flow::fileAdded' ... #131

Open agborkowski opened 9 years ago

agborkowski commented 9 years ago

do i need add something special like flowProvider to catch events inside controllers cause simple

$scope.$on('flow::fileAdded', function (event, $flow, flowFile) {
console.log('event inside controller never execute');
});
aaronpeterson commented 9 years ago

Same here. Inside a directive, at least, I never have access to $scope.$flow, nor do any of these events fire.

agborkowski commented 9 years ago

btw. files are attached properly and uploaded, console.log(events) in flowProvider return properly events but name events are different than flow::fileAdded maybe this is the point ?

technixp commented 9 years ago

You should put flow-init directive in the same dom element as controller

tarikmlaco commented 9 years ago

...and that Sir, is how you end a discussion :)

jabyrd3 commented 8 years ago

What if you want to initialize flow with an options variable defined as a scope variable of a directive's controller?

ie:

index.html:
<upload-files></upload-files>

uploadFiles.js: 
angular.module('app').directive('uploadFiles', function(){
  return {
      templateUrl: 'example.html',
      scope: {}, // mine has some bound values, this is just to show the isolate scope request
      link: function(){},
      controller: function($scope){
           $scope.flowInitOptions = {
                example: 1
           };
      }
  };
});

example.html :
<div flow-init="flowInitOptions"></div>

I'm not able to get any of the event directives to work (specifically flow-files-added or flow-file-added), and I can't access them on the directive's controller scope. I know I could shove all this up a level to the angular controller level, but architecturally that doesn't match the style we're going for (directive heavy, prepping for angular 2 porting, etc).