blob: b1b4e90166e0f2d06bfc78e12028ca7804c2dcb5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
angular
.module('nt.NoteService', ['ngResource'])
.factory('NoteService', [
'$resource',
function($resource) {
var Note = $resource('/notes/:id.json', { id: '@id' });
return {
notes: [],
current_note: null,
get_notes: function() {
this.notes = Note.query();
},
get_note: function(note) {
this.current_note = Note.get({ id: note.id });
},
save: function() {
Note.save({
id: this.current_note.id,
title: this.current_note.title,
body: this.current_note.body
});
}
};
}
]);
|