<!DOCTYPE html>
<html>
<head>
<title>Wikitechy AngularJS Tutorials</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
</head>
<body ng-app="deleteApp" ng-controller="deleteCtrl">
<h1>MYSQL Delete with PHP in AngularJS</h1>
<table border="1">
<tr>
<th>Id</th>
<th>Name</th>
<th>Mobile</th>
<th>Email</th>
<th>Delete</th>
</tr>
<tr ng-repeat="x in content">
<td>{{x.id}}</td>
<td>{{x.name}}</td>
<td>{{x.mobile}}</td>
<td>{{x.email}}</td>
<td><button ng-click="delete(x.id)">Delete</button></td>
</tr>
</table>
<h3>Please Use Ctrl+F5 for Refresh.</h3>
</body>
<script>
var App = angular.module('deleteApp', []);
App.controller('deleteCtrl', function($scope, $http) {
$http.get("select.php").then(function(response) {
$scope.content = response.data.details;
});
$scope.delete = function(value) {
$http({
method : 'POST',
url : 'delete.php',
data : ({value: value}),
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(data) {
$scope.content = data;
});
};
});
</script>
</html>