diff options
author | benal01 <bja4245@rit.edu> | 2025-03-17 17:08:04 -0400 |
---|---|---|
committer | benal01 <bja4245@rit.edu> | 2025-03-17 17:08:04 -0400 |
commit | bf33fa3ca9f29b1e75cc077ae2eaaf4f5725e4b3 (patch) | |
tree | 9a5d7255a75022407485d3687e07e96419bc416b | |
parent | 636ba167db911130097c99c4b199b144b3d80808 (diff) | |
download | JellySolutions-bf33fa3ca9f29b1e75cc077ae2eaaf4f5725e4b3.tar.gz JellySolutions-bf33fa3ca9f29b1e75cc077ae2eaaf4f5725e4b3.tar.bz2 JellySolutions-bf33fa3ca9f29b1e75cc077ae2eaaf4f5725e4b3.zip |
need list delete button
-rw-r--r-- | ufund-ui/src/app/components/need-list/need-list.component.html | 1 | ||||
-rw-r--r-- | ufund-ui/src/app/components/need-list/need-list.component.ts | 6 |
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) + }) + } } |