Hey angular peeps. I'm using ng-flow and the flow.js library to handle media uploads to my application. I can register listeners in flow.js directly using flow.on, but I'd prefer to use the angular $scope.$on approach, to avoid having to call $scope.$apply and stuff.
The problem is that my app is structured where I have a <media-upload> directive that handles (a) displaying the upload tool, (b) displays a consent screen, and (c) deals with some bookkeeping associated with the tool. That directive's template includes a <div flow-init> element where flow is actually active. My issue is that the controller for my overall directive is a parent scope to the flow-init directive, and ng-flow calls $scope.$broadcast on events it catches that it deems relevant to ng-flow, and not $scope.$emit. So events get thrown down the scope chain, and not back up. As a flow-specific thing, I could probably attach flow and upload stuff to the body of my HTML document, instead of the media upload widget. Then I'd be in a child controller (but would need to be careful about multiple actors catching events. It also bugs me a little with separation of concerns - I don't like needing to fiddle with app-level controllers to make a sub-route's included directive function. I was thinking about a more generic version of this. Would it make sense to write a reflector directive that I could get transcluded into the flow-init directive? The reflector would basically catch any and all events it was told about (give it an array of strings for event names in its attrs) and $emit them back up the stack. Anyone try anything like this? I could also, of course either fork ng-flow or just stick to what I'm doing now, and listen to events on my flow object instead of on my $scope. e -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
