title: Create Html local variable programmatically with Angular2
body: <p>I need to know if there is a way to create HTML local variables programmatically.</p>
  
  <p>I am developing a web app where I have an NgFor loop and I want to be able to assign a local variable to each sub element created by the NgFor.</p>
  
  <p>ie : </p>
  
  <pre><code>&lt;div *ngFor="#elt of eltList" &gt;
      &lt;span #setLocalVariable(elt.title)&gt;&lt;/span&gt;
  &lt;/div&gt;
  
  setLocalVariable(_title : string){
      let var = do some stuff to _title;
      return var;
  }
  </code></pre>
  
  <p>The exemple above shows you what I am trying to accomplish and obviously does not work.
  Is there a way to achieve this ? </p>
  
  <p>Thank you in advance.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>After seeing the answers I got (and i thank everyone who took the time to read my question and tried to answer it) i'll explain a bit more why i want it that way.</p>
  
  <p>I will be using : <code>loadIntoLocation()</code> from the <code>DynamicComponentLoader</code>.
  That function got as a 3rd parameter a string that refers to an anchors (ie : <code>#test</code> in an html element). Thats why i need to create those local variables with a name equal to the one of my <code>elt.title</code>.</p>