diff options
author | Teddy Wing | 2015-01-24 23:26:50 -0500 |
---|---|---|
committer | Teddy Wing | 2015-01-24 23:28:48 -0500 |
commit | 0ec62bcbe1abc707d1ce8ac47aefe378f0ae361e (patch) | |
tree | 861cad178fe1791bebb0dd497cec60d2f23deb2e | |
parent | 397bdfd9ee28b62afb88d9e2e6872d679a9e3b19 (diff) | |
download | Notes-angular-demo-0ec62bcbe1abc707d1ce8ac47aefe378f0ae361e.tar.bz2 |
services/notes.js: Change `save` function to `update`
Angular uses `save` for new resources. Change this to `update` since it
operates on existing resources.
-rw-r--r-- | app/assets/javascripts/services/notes.js | 6 | ||||
-rw-r--r-- | app/views/home/main.html.erb | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/app/assets/javascripts/services/notes.js b/app/assets/javascripts/services/notes.js index 389f25d..bda6ae7 100644 --- a/app/assets/javascripts/services/notes.js +++ b/app/assets/javascripts/services/notes.js @@ -6,7 +6,7 @@ angular var Note = $resource('/notes/:id.json', { id: '@id' }, { - save: { + update: { method: 'PUT' } }); @@ -23,8 +23,8 @@ angular this.current_note = note; }, - save: function() { - this.current_note.$save(); + update: function() { + this.current_note.$update(); }, create: function () { diff --git a/app/views/home/main.html.erb b/app/views/home/main.html.erb index 5117084..d7a2d65 100644 --- a/app/views/home/main.html.erb +++ b/app/views/home/main.html.erb @@ -18,7 +18,7 @@ <a href="#" class="button margin-left-8" ng-show="noteService.current_note" - ng-click="noteService.save()">Save</a> + ng-click="noteService.update()">Save</a> </div> </div> </div> |