title: Angular passing scope to ng-include
body: <p>I have a controller that I wrote that I use in multiple places in my app with <code>ng-include</code> and <code>ng-repeat</code>, like this:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div
    ng-repeat="item in items"
    ng-include="'item.html'"
    ng-controller="ItemController"
  &gt;&lt;/div&gt;
  </code></pre>
  
  <p>In the controller/template, I expect the <code>item</code> value to exist, and the whole thing is built around this idea. Now, though, I need to use the controller in a slightly different way, without the <code>ng-repeat</code>, but still need to be able to pass in an <code>item</code>. I saw <code>ng-init</code> and thought it could do what I needed, like this:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div
    ng-init="item = leftItem"
    ng-include="'item.html'"
    ng-controller="ItemController"
  &gt;&lt;/div&gt;
  &lt;div
    ng-init="item = rightItem"
    ng-include="'item.html'"
    ng-controller="ItemController"
  &gt;&lt;/div&gt;
  </code></pre>
  
  <p>But that does not seem to be working. Anyone have any ideas how I can pass in a variable for scope in a singular instance like this?</p>
  
  <p>Edit:
  The controller above this is loading in the <code>leftItem</code> and <code>rightItem</code> values, something like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>.controller('MainController', function($scope, ItemModel) {
      ItemModel.loadItems()
          .then(function(items) {
              $scope.$apply(function() {
                  $scope.leftItem = items.left;
                  $scope.rightItem = items.right;
              });
          });
  });
  </code></pre>