title: How to get current Controller $scope inside directive function in angularjs?
body: <p>Sample Link : <a href="http://plnkr.co/edit/QNAWi4NbRi7nZfSB6GFp?p=preview" rel="nofollow">Example </a></p>
  
  <p>Hi all,</p>
  
  <p>I created one Global Help button in index file based on url am loading dynamic help(html file) which is working fine. I need to identify which controller is activated and i need to pass current $scope as parameter to $scope.HelpFunction function.$scope.HelpFunction available in help directive. In directive I need to get current $scope.message from current controller. based on $scope i need to implement few logic any one help me on this.....</p>
  
  <pre><code>  .directive("help", function($location, $window){
      .directive("help", function($location, $window){
      return {
        restrict: "A",
        template: "&lt;button   ng-click=\"HelpFunction( )\"&gt;Help&lt;/button&gt;",
        scope: true,
        controller: function($scope){
            $scope.HelpFunction = function( ){
              //Here I need to access current  $scope value
              alert($scope.message)
                 //var url =$location.url();
                 //$window.open(url+ '.html', '', 'width=700,height=700');
            }
        },
        link: function(scope){
  
        }
      }
    })
  .controller('HomeController', function ($scope, router, $location) {
          $scope.message = "Home";
         $scope.TestFunction = function(data) {
          console.log("Home:" + $location.url())
    };
  
  })
  .controller('MainController', function ($scope, router) {
          $scope.message = "Main";
         $scope.TestFunction = function(data) {
          console.log("Main:" + data)
    };
  
  })
   .controller('Page1Controller', function ($scope, router) {
      $scope.message = "Page1";
    $scope.TestFunction = function(data) {
         console.log("Page2:" + data)
    };
  
  })
  </code></pre>