aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src
diff options
context:
space:
mode:
Diffstat (limited to 'ufund-ui/src')
-rw-r--r--ufund-ui/src/app/components/need-list/need-list.component.html1
-rw-r--r--ufund-ui/src/app/components/need-list/need-list.component.ts6
2 files changed, 7 insertions, 0 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 6e48d96..b8774f1 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
@@ -3,4 +3,5 @@
<a routerLink="/need/{{need.id}}">
{{need.name}}
</a>
+ <button (click)="delete(need.id)">Delete</button>
</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 a3eb072..579565c 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
@@ -18,4 +18,10 @@ export class NeedListComponent {
ngOnInit(): void {
this.cupboardService.getNeeds().subscribe(n => this.needs = n)
}
+
+ delete(id : number) {
+ this.cupboardService.deleteNeed(id).subscribe(() => {
+ this.needs = this.needs.filter(n => n.id !== id)
+ })
+ }
}