title: Angular 2 dynamic `template variable name`s for DynamicComponentLoader?
body: <p><strong>TL;DR:</strong></p>
  
  <ul>
  <li><a href="http://plnkr.co/edit/22gXUA6NdevtGENxzPet?p=info" rel="noreferrer">works but not dynamic</a></li>
  <li><a href="http://plnkr.co/edit/TxhuGsv0f2HzsK4Vx6Gh?p=preview" rel="noreferrer">dynamic but doesn't work</a></li>
  </ul>
  
  <p><strong>Explanation:</strong></p>
  
  <p>I'm dynamically creating Angular 2 components using <a href="https://angular.io/docs/ts/latest/api/core/DynamicComponentLoader-class.html" rel="noreferrer">DynamicComponentLoader</a>'s loadIntoLocation() function.</p>
  
  <p>The place to insert the component generated by this function is determined by its <code>anchorName</code> parameter, which excepts you to pass a 
  <code>Template Variable Name</code> (as a string).</p>
  
  <p>So in the example they use <code>&lt;div #child&gt;&lt;/div&gt;</code> in the template, then pass <code>'child'</code>. Which works fine.</p>
  
  <p>However, rather than having to link generated components to an element with variable name hard-coded into the template, I'd like to be able to, say, append them to a variable-sized list.</p>
  
  <p>Now, the <a href="https://angular.io/docs/ts/latest/api/core/NgFor-directive.html" rel="noreferrer">NgFor</a> page shows you have access to an index variable: <code>&lt;li *ng-for="#item of items; #i = index"&gt;...&lt;/li&gt;</code>. So it'd work if I could assign the list items such template variable names used on this index or the like, i.e. <code>#child1</code>, <code>#child2</code>, etc.</p>
  
  <p>So I'm inclined to try <code>&lt;div #{{foo}}&gt;&lt;/div&gt;</code> with an app variable foo as <code>"child"</code>. I'm having trouble debugging this since the front-end doesn't really show these template variable names in the DOM, but it seems this dynamic assignment is failing, resulting in an error <code>"Could not find variable ..."</code>.</p>
  
  <p>Might there be any way to do what I want? Or even to view assigned <code>template variable name</code>s from the browser for debugging?</p>