From 290cdb6afca0569f07bef4cbf994c4c04f988a05 Mon Sep 17 00:00:00 2001 From: JoshuaHamann Date: Mon, 6 Apr 2020 20:07:30 -0500 Subject: [PATCH] Add service to grab notes from server #17 --- client/src/app/notes/note-card.component.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/src/app/notes/note-card.component.ts b/client/src/app/notes/note-card.component.ts index 469df3d..7abe846 100644 --- a/client/src/app/notes/note-card.component.ts +++ b/client/src/app/notes/note-card.component.ts @@ -21,7 +21,16 @@ export class NoteCardComponent implements OnInit, OnDestroy { constructor(private route: ActivatedRoute, private noteService: NoteService) { } + getNotesFromServer(): void { + this.getNotesSub = this.noteService.getNotes({ owner_id: this.id }) + .subscribe(notes => + this.serverFilteredNotes = notes.reverse() + , err => { + console.log(err); + }); + } ngOnInit(): void { + this.getNotesFromServer(); } ngOnDestroy(): void {