AngularJS Example:

by Bardh Lohaj

HTML

<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<div ng-app="myApplication">
  <div ng-controller="TestingCtrl">
      <div class="contacts">
          <table>
              <tr>
                  <td class="contactIdTD">2</td>    
                  <td class="contactIdTD">3</td>                  
              </tr>
          </table>
      </div>      
      <input type="text" id="contactId" class="form-control" ng-model="contactId"/>
  </div>
</div>

CSS

.contactIdTD {
    width: 20px;
}

JavaScript

var myApplication = angular.module('myApplication', []);

myApplication.controller('TestingCtrl', ['$scope', function ($scope) {
  $scope.contactId = "";
}]);

$(document).ready(function() {
    $("div.contacts").on('click', "table tr td.contactIdTD", function() {
        $("#contactId").val($(this).text());
    });
});