From 85e046f2dd3571a74135c63119c79637503c94c8 Mon Sep 17 00:00:00 2001 From: Arti Zirk Date: Sat, 10 Jun 2017 22:25:11 +0300 Subject: [PATCH] Remove fancy js features --- ng1/app/edit.ctrl.js | 8 ++++---- ng1/app/search.ctrl.js | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ng1/app/edit.ctrl.js b/ng1/app/edit.ctrl.js index e6184f1..0f76beb 100644 --- a/ng1/app/edit.ctrl.js +++ b/ng1/app/edit.ctrl.js @@ -14,19 +14,19 @@ function getContact(id) { if(!id) return - $http.get(`/api/contacts/${id}`).then(resp => { + $http.get("/api/contacts/"+id).then(function(resp) { vm.contact = resp.data; }); }; function submitForm() { - console.log(vm.contact); + console.log("submitting contact", vm.contact); if(vm.contact._id) { - $http.put(`/api/contacts/${vm.contact._id}`, vm.contact).then(resp => { + $http.put("/api/contacts/"+vm.contact._id, vm.contact).then(function(resp){ $location.path("/search"); }); } else { - $http.post(`/api/contacts`, vm.contact).then(resp => { + $http.post("/api/contacts", vm.contact).then(function(resp){ $location.path("/search"); }); } diff --git a/ng1/app/search.ctrl.js b/ng1/app/search.ctrl.js index f7f7b39..6d34b39 100644 --- a/ng1/app/search.ctrl.js +++ b/ng1/app/search.ctrl.js @@ -15,17 +15,18 @@ getContacts(); function getContacts() { - $http.get("/api/contacts").then(resp => { + $http.get("/api/contacts").then(function(resp){ vm.contacts = resp.data; - }).catch(e => { + }).catch(function(e) { console.error("Failed to get contacts", e); }) + }; function deleteContact(id) { - modalService.confirm().then(resp => { - $http.delete(`/api/contacts/${id}`).then(resp => { - console.info(`Contact ${id}`) + modalService.confirm().then(function(resp) { + $http.delete("/api/contacts/"+id).then(function(resp) { + console.log("Deleted contact "+id) getContacts(); }) })