Reputation: 2359
I have a jquery/flash based microphone recording plugin and I want to be able to call a function inside an Angular controller to process the audio further.
Inside an ng-view I load a template and assign the controller I want to access via a routeProvider. In this template I have a top div element. I thought I could access the controller by doing:
e = document.getElementById("topElement");
scope = angular.element(e).scope();
And then in de microphone callback call:
scope.$apply(function() {
scope.functionInController(micData);
});
But scope.functionInController is not defined. By inspecting the scope element I can see that functionInController actually lives inside the $$childHead of the scope I retrieve, but I cannot seem to access it.
Upvotes: 1
Views: 338
Reputation: 17430
Change your callback to:
scope.$apply(function() {
scope.$$childHead.functionInController(micData);
});
Upvotes: 2