title: AngularJS: dynamically assign controller from ng-repeat
body: <p>I'm trying to dynamically assign a controller for included template like so:</p>
  
  <pre><code>&lt;section ng-repeat="panel in panels"&gt;
      &lt;div ng-include="'path/to/file.html'" ng-controller="{{panel}}"&gt;&lt;/div&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>But Angular complains that <code>{{panel}}</code> is undefined.</p>
  
  <p>I'm guessing that <code>{{panel}}</code> isn't defined <em>yet</em> (because I can echo out <code>{{panel}}</code> inside the template).</p>
  
  <p>I've seen plenty of examples of people setting <code>ng-controller</code> equal to a variable like so: <code>ng-controller="template.ctrlr"</code>. But, without creating a duplicate concurrant loop, I can't figure out how to have the value of <code>{{panel}}</code> available when <code>ng-controller</code> needs it.</p>
  
  <p>P.S. I also tried setting <code>ng-controller="{{panel}}"</code> in my template (thinking it must have resolved by then), but no dice.</p>