Guest User

Untitled

a guest
Jan 13th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. <table class="table">
  2. <tr>
  3. <th>title</th>
  4. <th>description</th>
  5. </tr>
  6. <tr *ngFor="let notes of Note">
  7. <td>{{notes.title}}</td>
  8. <td>{{notes.body}}</td>
  9. </tr>
  10. </table>
  11.  
  12. export class Note {
  13. noteId: number ;
  14. title: String ;
  15. body: String ;
  16. color: String ;
  17. isArchive: boolean ;
  18. isPinned: boolean ;
  19. isTrash: boolean ;
  20. }
  21.  
  22.  
  23.  
  24. notes:Note[]=[];
  25.  
  26. ngOnInit() {
  27. this.getAllNotes();
  28. }
  29. //get all anotes
  30. getAllNotes(){
  31. this.noteService.getNotes()
  32. .subscribe(
  33. // notes => { //tried not working
  34. // this.notes = notes;
  35. // console.log(notes) },
  36. data => {
  37. console.log("notes get");
  38. console.log(data._body);
  39. this.notes=data._body;
  40. console.log("notes array");
  41. console.log(this.notes);
  42. },
  43. error => {
  44. console.log("notes error");
  45. console.log(error);
  46.  
  47. });
  48. }
  49.  
  50. [
  51. {
  52. "noteId": 5,
  53. "title": "hi ",
  54. "body": "ragini",
  55. "color": null,
  56. "createDate": 1515820245951,
  57. "lastUpdated": 1515820245951,
  58. "reminder": null,
  59. "image": null,
  60. "collaborator": [],
  61. "labels": [],
  62. "user": 1,
  63. "archive": false,
  64. "pinned": false,
  65. "trash": false
  66. },
  67. {
  68. "noteId": 8,
  69. "title": "s",
  70. "body": null,
  71. "color": null,
  72. "createDate": 1515820746348,
  73. "lastUpdated": 1515820746348,
  74. "reminder": null,
  75. "image": null,
  76. "collaborator": [],
  77. "labels": [],
  78. "user": 1,
  79. "archive": false,
  80. "pinned": false,
  81. "trash": false
  82. }
  83. ]
  84.  
  85. <tr *ngFor="let note of notes">
  86. <td>{{note?.title}}</td>
  87. <td>{{note?.body}}</td>
  88. </tr>
Add Comment
Please, Sign In to add comment