Fixed success/failed alert and added callback to memberlist
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
|
||||
app.controller("getController", function($scope, $http){
|
||||
app.controller("getController", function($scope, $http, $window, $location){
|
||||
$scope.members = [];
|
||||
$scope.getMembers = $http.get("/members/api/members").then(function(response){
|
||||
$http.get("/members/api/members").then(function(response){
|
||||
$scope.members = response.data;
|
||||
});
|
||||
$scope.delete_member = function(id, $http) {
|
||||
$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");
|
||||
}
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user