title: Angularjs: How to access controller scope in directive?
body: <p>I have 2 elements like so:</p>
  
  <pre><code>&lt;div ng-hide="showDiv"&gt;&lt;/div&gt;
  &lt;div ng-show="showDiv"&gt;
     &lt;div directive&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And a directive like so:</p>
  
  <pre><code>app.directive ('directive', [
     ...
     controller: [
          '$scope',
          function ($scope) {
            $scope.accept = function () {
              $scope.showDiv = false;
            };
          }
        ],
     ....
  ]
  </code></pre>
  
  <p>I tried to use $scope.showDiv within the directive to toggle the controller but it didn't work. How do I access the controller's scope within the directive?</p>
  
  <p>console.log($scope) in the directive shows $scope.showDiv === false though $scope.showDiv === true in the controller.</p>