title: When to use nested controllers instead of services in angularjs?
body: <p>I just started to use AngularJS, so I'm not an expert.</p>
  
  <p>I have a div that represent the right area of my html view. In that div I have a controller, i.e.</p>
  
  <pre><code>&lt;div class="rightContainer" ng-controller="rightContainerCtrl"&gt;...&lt;/div&gt;
  </code></pre>
  
  <p>Inside that div I have a table, a search region, etc. Each region inside that div has its own controllers, it looks like this:</p>
  
  <pre><code>&lt;div class="rightContainer" ng-controller="rightContainerCtrl"&gt;
  ...
     &lt;div class="search" ng-controller="searchCtrl"&gt;...&lt;/div&gt;
  ...
     &lt;div class="table" ng-controller="tableCtrl"&gt;...&lt;/div&gt;
  
   &lt;/div&gt;
  </code></pre>
  
  <p>the search region for example has its own controller and it is a child of rightContainerCtrl because it needs to alter some content in the parent (rightContainerCtrl), but the rightContainer div is growing and now it's big, and contain several nested controllers.</p>
  
  <p>I think that using this nested controllers it's bad in this context because all the nested controllers share the parent scope, and not all controllers needs to access all the parent scope variables, also all the controllers are "prisoners" of the rightContainerCtrl, so they are highly coupled with their parent controller. </p>
  
  <p>It looks like a <a href="http://en.wikipedia.org/wiki/God_object" rel="noreferrer">God object</a> anti-pattern (God controller in this case), so I think that instead of using nested controllers I can refactor my code to eliminate the rightContainerCtrl controller and use a service instead (like in a <a href="http://en.wikipedia.org/wiki/Facade_pattern" rel="noreferrer">facade design pattern</a>), that service then will be used by the controllers instead of sharing scope variables.</p>
  
  <p>but since I'm not an AngularJs expert I'm not sure if I'm right or if it's better to leave this parent controller, maybe I'm missing something, so my question is </p>
  
  <p>When is better to use nested controllers (nested scopes) and when it's better to use services instead in angularjs?</p>