Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
- <style>
- .black {
- font-weight:bold;
- }
- .blue {
- }
- </style>
- </head>
- <body>
- <div ng-app="myApp" ng-controller="customersCtrl">
- <table>
- <tr ng-repeat="x in names" ng-mouseover="x.hovered=true" ng-mouseout="x.hovered=false" ng-class="x.hovered? 'black' : 'blue'">
- <td>{{ x.Name }}</td>
- <td>{{ x.Country }}</td>
- <td ng-click="delete(x)">×</td>
- </tr>
- </table>
- </div>
- <script>
- var app = angular.module('myApp', []);
- app.controller('customersCtrl', function($scope, $http) {
- $http.get("http://www.w3schools.com/angular/customers.php")
- .success(function (response) {$scope.names = response.records;});
- $scope.delete =function(record){
- var index = $scope.names.indexOf(record);
- $scope.names.splice(index, 1);
- }
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment