Reputation: 986
I am currently broadcasting to a child scope(from one parent controller to a child controller). In the $scope.$on
app.controller('myCtrl')
$scope.$on('broadcastName', function(e, d){
//I want to be able to access myCtrl's scope here even though
//the broadcast comes from another controller
});
I want to have access to the current controllers scope that catches the broadcast with in my $scope.$on function, not the parent controller that emitted the broadcast.
I figured the answer out as I was writing up the question.
Upvotes: 0
Views: 25
Reputation: 986
I hope this saves someone else some time
app.controller('myCtrl')
$scope.$on('broadcastName', function(e, d){
/* if you want the scope of the controller that made the broadcast */
console.log('parent scope', e.targetScope);
/* if you want the scope of the controller that caught the broadcast it is just your basic scope */
console.log('child scope', $scope);
});
Upvotes: 0