title: Init Method in AngularJS?
body: <p>I've been developing out some angular controllers and I've been coming up on a pattern that I'm not too big of a fan of.  Given the following:</p>
  
  <pre><code> app.controller('RecordCtrl', ['$scope', function AppBuilderCtrl($scope) {
  
        // do lots of object initing here ...
       $scope.model = { ... };
       $scope.defs = $scope.buildDefs($scope.model);
  
       // lots of functions on scope ...
       $scope.defs = function(model) { ... };
   });
  </code></pre>
  
  <p>The <code>defs</code> throws undefined ( duh its not defined until after ) but then I end up moving a lot of my init code to the bottom which doesn't seem that great.  I guess I could do something like:</p>
  
  <pre><code> // top of controller
   init = function(){ ... }
  
   // all my methods here
  
  init();
  </code></pre>
  
  <p>but thats eh too.  Any thoughts?</p>