Maybe help you
// Update or add new one customer
$scope.PostCustomer = function () {
$.post("api/customerapi",
$("#cusForm").serialize(),
function (value) {
// Refresh list
$http.get("/api/customerapi")
.success(function (response) {
$scope.Customer = response
});
alert("Saved successfully.");
},
"json"
);
}
// Delete one customer based on id.
$scope.delCustomer = function (id) {
if (confirm("Are you sure you want to delete this customer?")) {
// todo code for deletion
$http.delete("api/customerapi/" + id).success(function () {
alert("Deleted successfully.");
// Refresh list
$http.get("/api/customerapi")
.success(function (response) {
$scope.Customer = response
});
}).error(function () {
alert("Error.");
});
}
};
$http.get example here
<http://angularjsaz.blogspot.com/2015/09/tutorial-31-service-http-in-angularjs.html>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.