Guest User

Untitled

a guest
Oct 30th, 2015
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.93 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
  5. <style>
  6. .black {
  7. font-weight:bold;
  8. }
  9. .blue {
  10. }
  11. </style>
  12. </head>
  13. <body>
  14.  
  15. <div ng-app="myApp" ng-controller="customersCtrl">
  16.  
  17. <table>
  18.   <tr ng-repeat="x in names" ng-mouseover="x.hovered=true" ng-mouseout="x.hovered=false" ng-class="x.hovered? 'black' : 'blue'">
  19.     <td>{{ x.Name }}</td>
  20.     <td>{{ x.Country }}</td>
  21.     <td ng-click="delete(x)">&times;</td>
  22.   </tr>
  23. </table>
  24.  
  25. </div>
  26.  
  27. <script>
  28. var app = angular.module('myApp', []);
  29. app.controller('customersCtrl', function($scope, $http) {
  30.     $http.get("http://www.w3schools.com/angular/customers.php")
  31.     .success(function (response) {$scope.names = response.records;});
  32.  
  33.     $scope.delete =function(record){
  34.       var index = $scope.names.indexOf(record);
  35.       $scope.names.splice(index, 1);
  36.     }
  37. });
  38. </script>
  39.  
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment