title: How to assign focus function on last element in element.find()
body: <p>I was able to insert new input element on focus on first input element by doing this.
  here is the fiddle.</p>
  
  <p><a href="http://jsfiddle.net/nr0tbh86/1/" rel="nofollow">http://jsfiddle.net/nr0tbh86/1/</a></p>
  
  <p>html code:</p>
  
  <pre><code>&lt;div ng-app="myApp" ng-controller="MyCtrl"&gt;
      &lt;div add-input&gt;
          &lt;input type="text" placeholder="focus on this"&gt;&lt;br&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Controller.js:</p>
  
  <pre><code>var app = angular.module('myApp', []);
  
  app.controller('MyCtrl', ['$scope', function ($scope) {
      // Define $scope.telephone as an array
      $scope.inputFeild = [];
      // Create a counter to keep track of the additional telephone inputs
      $scope.inputCounter = 0;
  
      // This is just so you can see the array values changing and working! Check your console as you're typing in the inputs :)
      $scope.$watch('telephone', function (value) {
          console.log(value);
      }, true);
  }]);
  
  // I've created this directive as an example of $compile in action. 
  app.directive('addInput', ['$compile', function ($compile) { // inject $compile service as dependency
      return {
          restrict: 'A',
          link: function (scope, element, attrs) {
              // click on the button to add new input field
              element.find('input').bind('focus', function () {
                  // I'm using Angular syntax. Using jQuery will have the same effect
                  // Create input element
                  var input = angular.element('&lt;div&gt;&lt;input type="text" ng-model="inpuTfeild[' + scope.inputCounter + ']"&gt;&lt;/div&gt;');
                  // Compile the HTML and assign to scope
                  var compile = $compile(input)(scope);
  
                  // Append input to div
                     element.append(input);
  
                  // Increment the counter for the next input to be added
                  scope.inputCounter++;
              });
          }
      }
  }]);
  </code></pre>
  
  <p>But what I actually need is to generate an input on focusing last input.</p>