I think your controller is being initialized before your directive.. so the $on
starts listening after the $emit
, $broadcast
already happened.
see this plunker
open the console and you can see when the console.logs happen:
controller init happened script.js:16
link happened script.js:7
$scope.test() happened script.js:21
scope.$on happened script.js:9
scope.$on happened
If you initialize the controller with ng-view
or do the emit/broadcast after the directive is created, it should work.