title: Retrieving values from within the $scope.$on((, function(){});
body: <p>I emitted the width and height values of a rich text editor box and  retrieved those same values in a separate file using the $scope.$on function. My question is how do i access those values outside of the function yet within the same file.</p>
  
  <p>I tried using the "var" keyword before the function name and still get a <strong>variable undefined</strong> error. </p>
  
  <pre><code>//emit values    
  var onResizeComplete = function() {
    scope.$broadcast('wesRichTextEditorResizeComplete', {
        width: scope.width,
        height: scope.height 
    });
    scope.$emit('wesRichTextEditorResizeComplete', { 
        width: scope.width, 
        height: scope.height
    });   
  };
  
  //retrieve values
  $rootScope.$on('wesRichTextEditorResizeComplete', function(event, data){
    RTEboxWidth = data.width;
    var  RTEboxHeight = data.height;
  });
  </code></pre>
  
  <p>neither <code>console.log(RTEboxWidth);</code> nor <code>console.log(RTEboxHeight);</code> works</p>