title: Getting $scope object in Angular's run() method
body: <p>I'd like to do some stuff when my app loads to set up the default state. So I'm trying to use the run method on the Module object. When I try to access the $scope variable though I get an "Uncaught ReferenceError: $scope is not defined" message in my console.</p>
  
  <p>See the following example <a href="http://jsfiddle.net/F2Z2X/1/" rel="noreferrer">http://jsfiddle.net/F2Z2X/1/</a></p>
  
  <pre><code>app = angular.module('myapp', []);
  
  app.controller('mycontroller', function($scope){
      $scope.data = { myvariable: 'Hello' };
  });
  
  app.run(
      alert($scope.data.myvariable))
  );
  </code></pre>
  
  <p>Am I going about this all wrong?</p>
  
  <p>For example, I want to run the watchAction function once at the beginning, to hide UI elements that aren't called for yet, but the watchAction function doesn't have the $scope object because it's not being called by the watch method so I have to pass it to it, but alas it's not available.</p>