title: How to access variable defined in directive to controller?
body: <p>I have to access variable defined in directive and access it in the controller using angularjs
  directive :</p>
  
  <pre><code>app.directive('htmlData', function ($compile) {
  
      return {
          link: function($scope, element, attrs) {
                  $(element).on('click', function() {
                      $scope.html = $compile(element)($scope).html();
                  });
  
                  return $scope.html;
          }
  
      };
  });
  </code></pre>
  
  <p>and use $scope.html in controller.</p>