32 lines
910 B
JavaScript
32 lines
910 B
JavaScript
|
|
app.controller("getController", function($scope, $http, $window, $location){
|
|
$scope.members = [];
|
|
$http.get("/members/api/members").then(function(response){
|
|
$scope.members = response.data;
|
|
});
|
|
$scope.delete_member = function(id) {
|
|
$http.delete("/members/api/member/" + id).then(
|
|
function(response) {
|
|
$window.alert("Onnistui! Hyvä Harry!");
|
|
$location.path("#/list");
|
|
},
|
|
function(response) {
|
|
$window.alert("Epäonnistui. Yritä uudelleen.");
|
|
$location.path("#/list");
|
|
}
|
|
);
|
|
};
|
|
});
|
|
|
|
app.controller("postController", function($scope, $http) {
|
|
$scope.firstName = "";
|
|
$scope.lastName = "";
|
|
$scope.email = "";
|
|
$scope.AYY = "";
|
|
$scope.JAS = "";
|
|
$scope.POR = "";
|
|
$scope.send = function() {
|
|
$http.post("/members/api/member", {"first_name":$scope.firstName, "last_name":$scope.lastName, "email":$scope.email, "AYY":$scope.AYY, "jas":$scope.JAS, "POR":$scope.POR});
|
|
}
|
|
});
|