AngularJS Example

by Pablo Dorgambide

HTML

<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<div ng-app="app">
 <div ng-controller="ParentCtrl">
   <table class="table table-hover">
       <thead>
         <tr><th>Action</th></tr>
       </thead>
       <tbody>
       <tr ng-click="alert()">
       <td>Show Alert!!</td></tr>
       <tr ><td>( No Cursor )</td></tr>
       <tr ng-click="alert()"><td>Show Alert!!</td></tr>
       </tbody>
     </table>
 </div>
</div>

CSS

.table-hover > tbody > tr:hover {
    background-color: #f5f5f5;
}
tr[ng-click] {
    cursor: pointer;
}

JavaScript

angular.module('app', [])

function ParentCtrl($scope){
    $scope.alert = function(){
      alert("here");  
    };
}