aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/need-list
diff options
context:
space:
mode:
Diffstat (limited to 'ufund-ui/src/app/components/need-list')
-rw-r--r--ufund-ui/src/app/components/need-list/need-list.component.html7
-rw-r--r--ufund-ui/src/app/components/need-list/need-list.component.ts10
2 files changed, 16 insertions, 1 deletions
diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html
index d366ee6..6e48d96 100644
--- a/ufund-ui/src/app/components/need-list/need-list.component.html
+++ b/ufund-ui/src/app/components/need-list/need-list.component.html
@@ -1 +1,6 @@
-<p>need-list works!</p>
+<h1>Needs List</h1>
+<li *ngFor="let need of needs">
+ <a routerLink="/need/{{need.id}}">
+ {{need.name}}
+ </a>
+</li>
diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts
index 61ed089..a3eb072 100644
--- a/ufund-ui/src/app/components/need-list/need-list.component.ts
+++ b/ufund-ui/src/app/components/need-list/need-list.component.ts
@@ -1,4 +1,6 @@
import { Component } from '@angular/core';
+import {Need} from '../../models/Need';
+import {CupboardService} from '../../services/cupboard.service';
@Component({
selector: 'app-need-list',
@@ -7,5 +9,13 @@ import { Component } from '@angular/core';
styleUrl: './need-list.component.css'
})
export class NeedListComponent {
+ needs: Need[] = [];
+ constructor(
+ private cupboardService: CupboardService
+ ) {}
+
+ ngOnInit(): void {
+ this.cupboardService.getNeeds().subscribe(n => this.needs = n)
+ }
}