From 397bdfd9ee28b62afb88d9e2e6872d679a9e3b19 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 24 Jan 2015 23:17:55 -0500 Subject: services/notes.js: Simplify save function Leverage Angular `$resource`s `$save` method to simplify this function. --- app/assets/javascripts/services/notes.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/assets/javascripts/services/notes.js b/app/assets/javascripts/services/notes.js index bfa0b03..389f25d 100644 --- a/app/assets/javascripts/services/notes.js +++ b/app/assets/javascripts/services/notes.js @@ -24,12 +24,7 @@ angular }, save: function() { - console.log(this.current_note.body); - Note.save({ - id: this.current_note.id, - title: this.current_note.title, - body: this.current_note.body - }); + this.current_note.$save(); }, create: function () { -- cgit v1.2.3