title: Angularjs, set focus on an input in a table
body: <p>I have a table with input in each cell, I can add records to that table by clicking on a button.
  I would like to set focus on the first input of the last record created.
  I don't know if that's possible.
  If anyone can help me on this...</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function Ctrl($scope) {
    $scope.adresses = [];
    
    $scope.add = function() {
      var adr = {ville:null, codePostal:null}
      $scope.adresses.push(adr);
    };
    
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!doctype html&gt;
  &lt;html ng-app&gt;
    &lt;head&gt;
      &lt;script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"&gt;&lt;/script&gt;
      &lt;script src="script.js"&gt;&lt;/script&gt;
  
    &lt;/head&gt;
    &lt;body&gt;
  
  &lt;div ng-controller="Ctrl" &gt;
    &lt;button ng-click="add()"&gt; Add &lt;/button&gt;
    &lt;table&gt;
      &lt;tr&gt;
        
        &lt;th&gt;ville&lt;/th&gt;
        &lt;th&gt;adresse&lt;/th&gt;
      &lt;tr&gt;
      
      &lt;tr ng-repeat="adresse in adresses"&gt;
        &lt;td&gt;
         &lt;input ng-model="adresse.ville"/&gt;
        &lt;/td&gt;
        &lt;td&gt;
         &lt;input ng-model="adresse.codePostal"/&gt;
        &lt;/td&gt;
        
       
      &lt;tr&gt;
    &lt;/table&gt;
    
  &lt;/div&gt;
  
  
  
  
  
  
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>