Stack Overflow Question
http://stackoverflow.com/questions/34948715/set-focus-on-link-on-table-click
HTML
<div ng-app="app">
<table border="1" focus-on-link-please>
<tr>
<td><a href>Link A</a></td>
<td>Some text</td>
<td>Some text</td>
</tr>
<tr>
<td><a href>Link B</a></td>
<td>Some text</td>
<td>Some text</td>
</tr>
</table>
</div>
CSS
table {
width: 100%;
}
JavaScript
var app = angular.module('app', [])
app.directive('focusOnLinkPlease', function() {
return function(scope, elem, attrs) {
elem.bind('click', function(event) {
console.log('click!')
event.target.closest('tr').find('a').focus(); // Does not work :(
});
}
});