title: $scope.$on use passed value
body: <p>I get this problem when I send data with broadcast, here is my code:</p>
  
  <pre><code>$rootScope.$broadcast('myEvent',{
     data:"value"
   });
  </code></pre>
  
  <p>and my on code:</p>
  
  <pre><code>$scope.$on('myEvent', (event, args) =&gt; {
       $scope.data = args.data;
       console.log($scope.data);
    });
    console.log($scope.data);
  </code></pre>
  
  <p>The problem is, that console.log inside function displays value, but outside I get undefined, what I missed?
  thanks.</p>